mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
chore: replace omit (#28846)
* chore: Replace omit.js with rc-util omit * chore: Replace omit.js with rc-util omit * fix ts * fix ts * fix ts
This commit is contained in:
parent
3006be0d81
commit
4315ac567c
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import ResizeObserver from 'rc-resize-observer';
|
||||
import { ConfigContext, ConfigConsumerProps } from '../config-provider';
|
||||
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
|
||||
@ -269,7 +269,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
|
||||
let props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange']);
|
||||
// Omit this since `onTestUpdatePosition` only works on test.
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
props = omit(props, ['onTestUpdatePosition']);
|
||||
props = omit(props as typeof props & { onTestUpdatePosition: any }, ['onTestUpdatePosition']);
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -1,14 +1,15 @@
|
||||
/**
|
||||
* TODO: 4.0
|
||||
* - remove `dataSource`
|
||||
* - `size` not work with customizeInput
|
||||
* - customizeInput not feedback `ENTER` key since accessibility enhancement
|
||||
*
|
||||
* - Remove `dataSource`
|
||||
* - `size` not work with customizeInput
|
||||
* - CustomizeInput not feedback `ENTER` key since accessibility enhancement
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import toArray from 'rc-util/lib/Children/toArray';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Select, { InternalSelectProps, OptionType, RefSelectProps } from '../select';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
@ -115,7 +116,10 @@ const AutoComplete: React.ForwardRefRenderFunction<RefSelectProps, AutoCompleteP
|
||||
prefixCls={prefixCls}
|
||||
className={classNames(`${prefixCls}-auto-complete`, className)}
|
||||
mode={Select.SECRET_COMBOBOX_MODE_DO_NOT_USE as any}
|
||||
getInputElement={getInputElement}
|
||||
{...{
|
||||
// Internal api
|
||||
getInputElement,
|
||||
}}
|
||||
>
|
||||
{optionChildren}
|
||||
</Select>
|
||||
|
@ -3,7 +3,7 @@ import CSSMotion from 'rc-motion';
|
||||
import addEventListener from 'rc-util/lib/Dom/addEventListener';
|
||||
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import VerticalAlignTopOutlined from '@ant-design/icons/VerticalAlignTopOutlined';
|
||||
import { throttleByAnimationFrame } from '../_util/throttleByAnimationFrame';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable react/button-has-type */
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
|
||||
import Group from './button-group';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
@ -262,7 +262,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
? spaceChildren(children, isNeedInserted() && autoInsertSpace)
|
||||
: null;
|
||||
|
||||
const linkButtonRestProps = omit(rest as AnchorButtonProps, ['navigate']);
|
||||
const linkButtonRestProps = omit(rest as AnchorButtonProps & { navigate: any }, ['navigate']);
|
||||
if (linkButtonRestProps.href !== undefined) {
|
||||
return (
|
||||
<a {...linkButtonRestProps} className={classes} onClick={handleClick} ref={buttonRef}>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Grid from './Grid';
|
||||
import Meta from './Meta';
|
||||
import Tabs, { TabsProps } from '../tabs';
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import RcCascader from 'rc-cascader';
|
||||
import arrayTreeFilter from 'array-tree-filter';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import KeyCode from 'rc-util/lib/KeyCode';
|
||||
import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
|
||||
import DownOutlined from '@ant-design/icons/DownOutlined';
|
||||
@ -89,9 +89,9 @@ export interface CascaderProps {
|
||||
placeholder?: string;
|
||||
/** 输入框大小,可选 `large` `default` `small` */
|
||||
size?: SizeType;
|
||||
/** 输入框name */
|
||||
/** 输入框 name */
|
||||
name?: string;
|
||||
/** 输入框id */
|
||||
/** 输入框 id */
|
||||
id?: string;
|
||||
/** Whether has border style */
|
||||
bordered?: boolean;
|
||||
@ -119,6 +119,11 @@ export interface CascaderProps {
|
||||
fieldNames?: FieldNamesType;
|
||||
suffixIcon?: React.ReactNode;
|
||||
dropdownRender?: (menus: React.ReactNode) => React.ReactNode;
|
||||
|
||||
// Miss prop defines.
|
||||
autoComplete?: string;
|
||||
transitionName?: string;
|
||||
children?: React.ReactElement;
|
||||
}
|
||||
|
||||
export interface CascaderState {
|
||||
@ -547,26 +552,32 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
|
||||
|
||||
// Fix bug of https://github.com/facebook/react/pull/5004
|
||||
// and https://fb.me/react-unknown-prop
|
||||
const inputProps = omit(otherProps, [
|
||||
'onChange',
|
||||
'options',
|
||||
'popupPlacement',
|
||||
'transitionName',
|
||||
'displayRender',
|
||||
'onPopupVisibleChange',
|
||||
'changeOnSelect',
|
||||
'expandTrigger',
|
||||
'popupVisible',
|
||||
'getPopupContainer',
|
||||
'loadData',
|
||||
'popupClassName',
|
||||
'filterOption',
|
||||
'renderFilteredOption',
|
||||
'sortFilteredOption',
|
||||
'notFoundContent',
|
||||
'fieldNames',
|
||||
'bordered',
|
||||
]);
|
||||
const inputProps = omit(
|
||||
// Not know why these props left
|
||||
otherProps as typeof otherProps & {
|
||||
filterOption: any;
|
||||
renderFilteredOption: any;
|
||||
sortFilteredOption: any;
|
||||
defaultValue: any;
|
||||
},
|
||||
[
|
||||
'onChange',
|
||||
'options',
|
||||
'popupPlacement',
|
||||
'transitionName',
|
||||
'displayRender',
|
||||
'onPopupVisibleChange',
|
||||
'changeOnSelect',
|
||||
'expandTrigger',
|
||||
'popupVisible',
|
||||
'getPopupContainer',
|
||||
'loadData',
|
||||
'filterOption',
|
||||
'renderFilteredOption',
|
||||
'sortFilteredOption',
|
||||
'fieldNames',
|
||||
],
|
||||
);
|
||||
|
||||
let { options } = props;
|
||||
const names: FilledFieldNamesType = getFilledFieldNames(this.props);
|
||||
@ -611,12 +622,12 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
|
||||
inputIcon = <DownOutlined className={arrowCls} />;
|
||||
}
|
||||
|
||||
const input = children || (
|
||||
const input: React.ReactElement = children || (
|
||||
<span style={style} className={pickerCls}>
|
||||
<span className={`${prefixCls}-picker-label`}>{this.getLabel()}</span>
|
||||
<Input
|
||||
{...inputProps}
|
||||
tabIndex="-1"
|
||||
tabIndex={-1}
|
||||
ref={this.saveInput}
|
||||
prefixCls={inputPrefixCls}
|
||||
placeholder={value && value.length > 0 ? undefined : placeholder}
|
||||
@ -649,7 +660,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
|
||||
);
|
||||
|
||||
const getPopupContainer = props.getPopupContainer || getContextPopupContainer;
|
||||
const rest = omit(props, [
|
||||
const rest = omit(props as typeof props & { inputIcon: any; loadingIcon: any }, [
|
||||
'inputIcon',
|
||||
'expandIcon',
|
||||
'loadingIcon',
|
||||
@ -677,7 +688,8 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
|
||||
loadingIcon={loadingIcon}
|
||||
popupClassName={rcCascaderPopupClassName}
|
||||
popupPlacement={this.getPopupPlacement(direction)}
|
||||
dropdownRender={dropdownRender}
|
||||
// rc-cascader should update ts define to fix this case
|
||||
dropdownRender={dropdownRender as any}
|
||||
>
|
||||
{input}
|
||||
</RcCascader>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Checkbox, { CheckboxChangeEvent } from './Checkbox';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
|
||||
|
@ -5,7 +5,7 @@ import classNames from 'classnames';
|
||||
import RightOutlined from '@ant-design/icons/RightOutlined';
|
||||
|
||||
import toArray from 'rc-util/lib/Children/toArray';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import CollapsePanel, { CollapsibleType } from './CollapsePanel';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import collapseMotion from '../_util/motion';
|
||||
@ -95,8 +95,8 @@ const Collapse: CollapseInterface = props => {
|
||||
if (child.props?.disabled) {
|
||||
const key = child.key || String(index);
|
||||
const { disabled, collapsible } = child.props;
|
||||
const childProps: CollapseProps = {
|
||||
...omit(child.props, 'disabled'),
|
||||
const childProps: CollapseProps & { key: React.Key } = {
|
||||
...omit(child.props, ['disabled']),
|
||||
key,
|
||||
collapsible: collapsible ?? (disabled ? 'disabled' : undefined),
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ import RcDrawer from 'rc-drawer';
|
||||
import getScrollBarSize from 'rc-util/lib/getScrollBarSize';
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import { ConfigContext, DirectionType } from '../config-provider';
|
||||
import { tuple } from '../_util/type';
|
||||
|
||||
@ -304,7 +304,6 @@ class Drawer extends React.Component<InternalDrawerProps, IDrawerState> {
|
||||
'footer',
|
||||
'title',
|
||||
'push',
|
||||
'visible',
|
||||
'width',
|
||||
'height',
|
||||
])}
|
||||
|
@ -7,7 +7,7 @@ import { FieldProps } from 'rc-field-form/lib/Field';
|
||||
import FieldContext from 'rc-field-form/lib/FieldContext';
|
||||
import { Meta, NamePath } from 'rc-field-form/lib/interface';
|
||||
import { supportRef } from 'rc-util/lib/ref';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Row from '../grid/row';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import { tuple } from '../_util/type';
|
||||
@ -204,24 +204,19 @@ function FormItem<Values = any>(props: FormItemProps<Values>): React.ReactElemen
|
||||
'extra',
|
||||
'getValueFromEvent',
|
||||
'getValueProps',
|
||||
'hasFeedback',
|
||||
'help',
|
||||
'htmlFor',
|
||||
'id', // It is deprecated because `htmlFor` is its replacement.
|
||||
'initialValue',
|
||||
'isListField',
|
||||
'label',
|
||||
'labelAlign',
|
||||
'labelCol',
|
||||
'normalize',
|
||||
'preserve',
|
||||
'required',
|
||||
'tooltip',
|
||||
'validateFirst',
|
||||
'validateStatus',
|
||||
'valuePropName',
|
||||
'wrapperCol',
|
||||
'_internalItemRender',
|
||||
'_internalItemRender' as any,
|
||||
])}
|
||||
>
|
||||
{/* Label */}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import { FormProvider as RcFormProvider } from 'rc-field-form';
|
||||
import { FormProviderProps as RcFormProviderProps } from 'rc-field-form/lib/FormContext';
|
||||
import { ColProps } from '../grid/col';
|
||||
@ -35,7 +35,9 @@ export const FormItemContext = React.createContext<FormItemContextProps>({
|
||||
});
|
||||
|
||||
/** Form Provider */
|
||||
export interface FormProviderProps extends Omit<RcFormProviderProps, 'validateMessages'> {}
|
||||
export interface FormProviderProps extends Omit<RcFormProviderProps, 'validateMessages'> {
|
||||
prefixCls?: string;
|
||||
}
|
||||
|
||||
export const FormProvider: React.FC<FormProviderProps> = props => {
|
||||
const providerProps = omit(props, ['prefixCls']);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import Group from './Group';
|
||||
import Search from './Search';
|
||||
import TextArea from './TextArea';
|
||||
@ -266,7 +266,7 @@ class Input extends React.Component<InputProps, InputState> {
|
||||
) => {
|
||||
const { className, addonBefore, addonAfter, size: customizeSize, disabled } = this.props;
|
||||
// Fix https://fb.me/react-unknown-prop
|
||||
const otherProps = omit(this.props, [
|
||||
const otherProps = omit(this.props as InputProps & { inputType: any }, [
|
||||
'prefixCls',
|
||||
'onPressEnter',
|
||||
'addonBefore',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import EyeOutlined from '@ant-design/icons/EyeOutlined';
|
||||
import EyeInvisibleOutlined from '@ant-design/icons/EyeInvisibleOutlined';
|
||||
|
||||
@ -20,7 +20,7 @@ const ActionMap: Record<string, string> = {
|
||||
hover: 'onMouseOver',
|
||||
};
|
||||
|
||||
const Password = React.forwardRef<unknown, PasswordProps>((props, ref) => {
|
||||
const Password = React.forwardRef<any, PasswordProps>((props, ref) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
const onVisibleChange = () => {
|
||||
@ -78,7 +78,7 @@ const Password = React.forwardRef<unknown, PasswordProps>((props, ref) => {
|
||||
className: inputClassName,
|
||||
prefixCls: inputPrefixCls,
|
||||
suffix: suffixIcon,
|
||||
};
|
||||
} as InputProps;
|
||||
|
||||
if (size) {
|
||||
omittedProps.size = size;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import RcTextArea, { TextAreaProps as RcTextAreaProps } from 'rc-textarea';
|
||||
import ResizableTextArea from 'rc-textarea/lib/ResizableTextArea';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
||||
import ClearableLabeledInput from './ClearableLabeledInput';
|
||||
@ -44,7 +44,7 @@ const TextArea = React.forwardRef<TextAreaRef, TextAreaProps>(
|
||||
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||
const size = React.useContext(SizeContext);
|
||||
|
||||
const innerRef = React.useRef<RcTextArea>();
|
||||
const innerRef = React.useRef<RcTextArea>(null);
|
||||
const clearableInputRef = React.useRef<ClearableLabeledInput>(null);
|
||||
|
||||
const [value, setValue] = useMergedState(props.defaultValue, {
|
||||
@ -99,7 +99,7 @@ const TextArea = React.forwardRef<TextAreaRef, TextAreaProps>(
|
||||
[`${prefixCls}-sm`]: size === 'small' || customizeSize === 'small',
|
||||
[`${prefixCls}-lg`]: size === 'large' || customizeSize === 'large',
|
||||
})}
|
||||
style={showCount ? null : style}
|
||||
style={showCount ? undefined : style}
|
||||
prefixCls={prefixCls}
|
||||
onChange={handleChange}
|
||||
ref={innerRef}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { useContext, useRef, useState, useEffect } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import BarsOutlined from '@ant-design/icons/BarsOutlined';
|
||||
import RightOutlined from '@ant-design/icons/RightOutlined';
|
||||
import LeftOutlined from '@ant-design/icons/LeftOutlined';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { SubMenu as RcSubMenu } from 'rc-menu';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import MenuContext, { MenuContextProps } from './MenuContext';
|
||||
import { isValidElement } from '../_util/reactNode';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
||||
import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
|
||||
@ -171,10 +171,8 @@ export default class Progress extends React.Component<ProgressProps> {
|
||||
'width',
|
||||
'gapDegree',
|
||||
'gapPosition',
|
||||
'strokeColor',
|
||||
'strokeLinecap',
|
||||
'percent',
|
||||
'steps',
|
||||
'success',
|
||||
'successPercent',
|
||||
])}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// TODO: 4.0 - codemod should help to change `filterOption` to support node props.
|
||||
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import RcSelect, { Option, OptGroup, SelectProps as RcSelectProps } from 'rc-select';
|
||||
import { OptionProps } from 'rc-select/lib/Option';
|
||||
@ -103,7 +103,7 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
prefixCls,
|
||||
});
|
||||
|
||||
const selectProps = omit(props, ['suffixIcon', 'itemIcon']);
|
||||
const selectProps = omit(props as typeof props & { itemIcon: any }, ['suffixIcon', 'itemIcon']);
|
||||
|
||||
const rcSelectRtlDropDownClassName = classNames(dropdownClassName, {
|
||||
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl',
|
||||
@ -122,7 +122,7 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
|
||||
|
||||
return (
|
||||
<RcSelect<VT>
|
||||
ref={ref}
|
||||
ref={ref as any}
|
||||
virtual={virtual}
|
||||
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
|
||||
{...selectProps}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import Element, { SkeletonElementProps } from './Element';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import Element, { SkeletonElementProps } from './Element';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import Element, { SkeletonElementProps } from './Element';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import debounce from 'lodash/debounce';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import { tuple } from '../_util/type';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import RcSteps from 'rc-steps';
|
||||
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import RcTable, { Summary } from 'rc-table';
|
||||
import { TableProps as RcTableProps, INTERNAL_HOOKS } from 'rc-table/lib/Table';
|
||||
import { convertChildrenToColumns } from 'rc-table/lib/hooks/useColumns';
|
||||
@ -236,11 +236,7 @@ function Table<RecordType extends object = any>(props: TableProps<RecordType>) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Controlled state in `columns` is not a good idea that makes too many code (1000+ line?) to read
|
||||
* state out and then put it back to title render. Move these code into `hooks` but still too
|
||||
* complex. We should provides Table props like `sorter` & `filter` to handle control in next big version.
|
||||
*/
|
||||
/** Controlled state in `columns` is not a good idea that makes too many code (1000+ line?) to read state out and then put it back to title render. Move these code into `hooks` but still too complex. We should provides Table props like `sorter` & `filter` to handle control in next big version. */
|
||||
|
||||
// ============================ Sorter =============================
|
||||
const onSorterChange = (
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
|
||||
import CheckableTag from './CheckableTag';
|
||||
@ -36,7 +36,7 @@ export interface TagType
|
||||
CheckableTag: typeof CheckableTag;
|
||||
}
|
||||
|
||||
const InternalTag: React.ForwardRefRenderFunction<unknown, TagProps> = (
|
||||
const InternalTag: React.ForwardRefRenderFunction<HTMLSpanElement, TagProps> = (
|
||||
{
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import classNames from 'classnames';
|
||||
import DownOutlined from '@ant-design/icons/DownOutlined';
|
||||
import Checkbox from '../checkbox';
|
||||
|
@ -7,7 +7,7 @@ import RcTreeSelect, {
|
||||
TreeSelectProps as RcTreeSelectProps,
|
||||
} from 'rc-tree-select';
|
||||
import classNames from 'classnames';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import { DefaultValueType } from 'rc-tree-select/lib/interface';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
@ -90,7 +90,7 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
const isMultiple = !!(treeCheckable || multiple);
|
||||
|
||||
// ===================== Icons =====================
|
||||
const { suffixIcon, itemIcon, removeIcon, clearIcon } = getIcons({
|
||||
const { suffixIcon, removeIcon, clearIcon } = getIcons({
|
||||
...props,
|
||||
multiple: isMultiple,
|
||||
prefixCls,
|
||||
@ -105,7 +105,7 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
}
|
||||
|
||||
// ==================== Render =====================
|
||||
const selectProps = omit(props, [
|
||||
const selectProps = omit(props as typeof props & { itemIcon: any; switcherIcon: any }, [
|
||||
'suffixIcon',
|
||||
'itemIcon',
|
||||
'removeIcon',
|
||||
@ -130,7 +130,7 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
virtual={virtual}
|
||||
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
|
||||
{...selectProps}
|
||||
ref={ref}
|
||||
ref={ref as any}
|
||||
prefixCls={prefixCls}
|
||||
className={mergedClassName}
|
||||
listHeight={listHeight}
|
||||
@ -139,14 +139,13 @@ const InternalTreeSelect = <T extends DefaultValueType>(
|
||||
treeCheckable ? <span className={`${prefixCls}-tree-checkbox-inner`} /> : treeCheckable
|
||||
}
|
||||
inputIcon={suffixIcon}
|
||||
menuItemSelectedIcon={itemIcon}
|
||||
multiple={multiple}
|
||||
removeIcon={removeIcon}
|
||||
clearIcon={clearIcon}
|
||||
switcherIcon={(nodeProps: AntTreeNodeProps) =>
|
||||
renderSwitcherIcon(treePrefixCls, switcherIcon, treeLine, nodeProps)
|
||||
}
|
||||
showTreeIcon={treeIcon}
|
||||
showTreeIcon={treeIcon as any}
|
||||
notFoundContent={mergedNotFound}
|
||||
getPopupContainer={getPopupContainer || getContextPopupContainer}
|
||||
treeMotion={null}
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import toArray from 'rc-util/lib/Children/toArray';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import omit from 'omit.js';
|
||||
import omit from 'rc-util/lib/omit';
|
||||
import EditOutlined from '@ant-design/icons/EditOutlined';
|
||||
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
||||
import CopyOutlined from '@ant-design/icons/CopyOutlined';
|
||||
@ -456,8 +456,9 @@ class Base extends React.Component<InternalBlockProps, BaseState> {
|
||||
'underline',
|
||||
'strong',
|
||||
'keyboard',
|
||||
...configConsumerProps,
|
||||
]);
|
||||
...(configConsumerProps as any),
|
||||
]) as any;
|
||||
|
||||
const cssEllipsis = this.canUseCSSEllipsis();
|
||||
const cssTextOverflow = rows === 1 && cssEllipsis;
|
||||
const cssLineClamp = rows && rows > 1 && cssEllipsis;
|
||||
@ -519,7 +520,7 @@ class Base extends React.Component<InternalBlockProps, BaseState> {
|
||||
)}
|
||||
style={{
|
||||
...style,
|
||||
WebkitLineClamp: cssLineClamp ? rows : null,
|
||||
WebkitLineClamp: cssLineClamp ? rows : undefined,
|
||||
}}
|
||||
component={component}
|
||||
ref={this.contentRef}
|
||||
|
@ -116,7 +116,6 @@
|
||||
"copy-to-clipboard": "^3.2.0",
|
||||
"lodash": "^4.17.20",
|
||||
"moment": "^2.25.3",
|
||||
"omit.js": "^2.0.2",
|
||||
"rc-cascader": "~1.4.0",
|
||||
"rc-checkbox": "~2.3.0",
|
||||
"rc-collapse": "~3.1.0",
|
||||
@ -146,7 +145,7 @@
|
||||
"rc-tree": "~4.1.0",
|
||||
"rc-tree-select": "~4.3.0",
|
||||
"rc-upload": "~3.3.4",
|
||||
"rc-util": "^5.6.6",
|
||||
"rc-util": "^5.7.0",
|
||||
"scroll-into-view-if-needed": "^2.2.25",
|
||||
"warning": "^4.0.3"
|
||||
},
|
||||
|
2
typings/custom-typings.d.ts
vendored
2
typings/custom-typings.d.ts
vendored
@ -18,8 +18,6 @@ declare module 'jsonml.js/*';
|
||||
|
||||
declare module 'rc-pagination/*';
|
||||
|
||||
declare module 'omit.js';
|
||||
|
||||
declare module 'rc-animate*';
|
||||
|
||||
declare module 'rc-util*';
|
||||
|
Loading…
Reference in New Issue
Block a user