mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-13 04:53:11 +08:00
fix lint
This commit is contained in:
parent
d6390802d3
commit
1e359b0309
@ -98,23 +98,21 @@ export interface FormInstance extends RcFormInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useForm(form?: FormInstance): [FormInstance] {
|
export function useForm(form?: FormInstance): [FormInstance] {
|
||||||
const wrapForm: FormInstance = form
|
const wrapForm: FormInstance = form || {
|
||||||
? form
|
...useRcForm()[0],
|
||||||
: {
|
__INTERNAL__: {},
|
||||||
...useRcForm()[0],
|
scrollToField: name => {
|
||||||
__INTERNAL__: {},
|
const namePath = toArray(name);
|
||||||
scrollToField: name => {
|
const fieldId = getFieldId(namePath, wrapForm.__INTERNAL__.name);
|
||||||
const namePath = toArray(name);
|
const node: HTMLElement | null = fieldId ? document.getElementById(fieldId) : null;
|
||||||
const fieldId = getFieldId(namePath, wrapForm.__INTERNAL__.name);
|
|
||||||
const node: HTMLElement | null = fieldId ? document.getElementById(fieldId) : null;
|
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
scrollIntoView(node, getScrollableContainer(node), {
|
scrollIntoView(node, getScrollableContainer(node), {
|
||||||
onlyScrollIfNeeded: true,
|
onlyScrollIfNeeded: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return [wrapForm];
|
return [wrapForm];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as AntdIcons from '@ant-design/icons';
|
import Icon, * as AntdIcons from '@ant-design/icons';
|
||||||
import { Radio, Input } from 'antd';
|
import { Radio, Input } from 'antd';
|
||||||
import { RadioChangeEvent } from 'antd/es/radio/interface';
|
import { RadioChangeEvent } from 'antd/es/radio/interface';
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import Icon from '@ant-design/icons';
|
|
||||||
import { ThemeType } from 'antd/es/icon';
|
import { ThemeType } from 'antd/es/icon';
|
||||||
import Category from './Category';
|
import Category from './Category';
|
||||||
import IconPicSearcher from './IconPicSearcher';
|
import IconPicSearcher from './IconPicSearcher';
|
||||||
@ -39,14 +38,14 @@ class IconDisplay extends React.Component<IconDisplayProps, IconDisplayState> {
|
|||||||
this.handleSearchIcon = debounce(this.handleSearchIcon, 300);
|
this.handleSearchIcon = debounce(this.handleSearchIcon, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
getComputedDisplayList() {
|
getComputedDisplayList = () => {
|
||||||
return Object.keys(categories)
|
return Object.keys(categories)
|
||||||
.map((category: CategoriesKeys) => ({
|
.map((category: CategoriesKeys) => ({
|
||||||
category,
|
category,
|
||||||
icons: (IconDisplay.categories[category] || []).filter(name => !!allIcons[name]),
|
icons: (IconDisplay.categories[category] || []).filter(name => !!allIcons[name]),
|
||||||
}))
|
}))
|
||||||
.filter(({ icons }) => Boolean(icons.length));
|
.filter(({ icons }) => Boolean(icons.length));
|
||||||
}
|
};
|
||||||
|
|
||||||
handleChangeTheme = (e: RadioChangeEvent) => {
|
handleChangeTheme = (e: RadioChangeEvent) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -71,7 +70,9 @@ class IconDisplay extends React.Component<IconDisplayProps, IconDisplayState> {
|
|||||||
icons: icons
|
icons: icons
|
||||||
.filter(name => {
|
.filter(name => {
|
||||||
if (theme === 'outlined') {
|
if (theme === 'outlined') {
|
||||||
return ['filled', 'twotone'].every(theme => !name.toLowerCase().includes(theme));
|
return ['filled', 'twotone'].every(
|
||||||
|
themeName => !name.toLowerCase().includes(themeName),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return name.toLowerCase().includes(theme);
|
return name.toLowerCase().includes(theme);
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user