mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
fix: delete defaultprops (#37966)
This commit is contained in:
parent
e13dd21a9a
commit
768ab54426
@ -196,7 +196,7 @@ class Spin extends React.Component<SpinClassProps, SpinState> {
|
||||
}
|
||||
}
|
||||
|
||||
const SpinFC: SpinFCType = (props: SpinProps) => {
|
||||
const SpinFC: SpinFCType = props => {
|
||||
const { prefixCls: customizePrefixCls } = props;
|
||||
const { getPrefixCls } = React.useContext(ConfigContext);
|
||||
|
||||
|
@ -557,7 +557,6 @@ const ForwardTable = React.forwardRef(InternalTable) as <RecordType extends obje
|
||||
type InternalTableType = typeof ForwardTable;
|
||||
|
||||
interface TableInterface extends InternalTableType {
|
||||
defaultProps?: Partial<TableProps<any>>;
|
||||
SELECTION_COLUMN: typeof SELECTION_COLUMN;
|
||||
EXPAND_COLUMN: typeof RcTable.EXPAND_COLUMN;
|
||||
SELECTION_ALL: 'SELECT_ALL';
|
||||
|
@ -23,7 +23,6 @@ export interface DirectoryTreeProps<T extends BasicDataNode = DataNode> extends
|
||||
type DirectoryTreeCompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(
|
||||
props: React.PropsWithChildren<DirectoryTreeProps<T>> & { ref?: React.Ref<RcTree> },
|
||||
) => React.ReactElement) & {
|
||||
defaultProps: Partial<React.PropsWithChildren<DirectoryTreeProps<any>>>;
|
||||
displayName?: string;
|
||||
};
|
||||
|
||||
|
@ -157,7 +157,6 @@ export interface TreeProps<T extends BasicDataNode = DataNode>
|
||||
type CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(
|
||||
props: React.PropsWithChildren<TreeProps<T>> & { ref?: React.Ref<RcTree> },
|
||||
) => React.ReactElement) & {
|
||||
defaultProps: Partial<React.PropsWithChildren<TreeProps<any>>>;
|
||||
TreeNode: typeof TreeNode;
|
||||
DirectoryTree: typeof DirectoryTree;
|
||||
};
|
||||
|
@ -13,12 +13,6 @@ interface ColorPickerProps {
|
||||
}
|
||||
|
||||
export default class ColorPicker extends Component<ColorPickerProps> {
|
||||
static defaultProps = {
|
||||
onChange: noop,
|
||||
onChangeComplete: noop,
|
||||
position: 'bottom',
|
||||
};
|
||||
|
||||
static getDerivedStateFromProps(props: ColorPickerProps) {
|
||||
if ('color' in props) {
|
||||
return {
|
||||
@ -43,28 +37,28 @@ export default class ColorPicker extends Component<ColorPickerProps> {
|
||||
};
|
||||
|
||||
handleChange = (color: { hex: string }) => {
|
||||
const { onChange } = this.props;
|
||||
const { onChange = noop } = this.props;
|
||||
this.setState({ color: color.hex });
|
||||
onChange(color.hex, color);
|
||||
};
|
||||
|
||||
handleChangeComplete = (color: { hex: string }) => {
|
||||
const { onChangeComplete } = this.props;
|
||||
const { onChangeComplete = noop } = this.props;
|
||||
this.setState({ color: color.hex });
|
||||
onChangeComplete(color.hex);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { small, position, presetColors } = this.props;
|
||||
const { small, position = 'bottom', presetColors } = this.props;
|
||||
const { color, displayColorPicker } = this.state;
|
||||
const width = small ? 80 : 120;
|
||||
const styles = {
|
||||
const styles: Record<PropertyKey, React.CSSProperties> = {
|
||||
color: {
|
||||
width: `${width}px`,
|
||||
height: small ? '16px' : '24px',
|
||||
borderRadius: '2px',
|
||||
background: color,
|
||||
} as React.CSSProperties,
|
||||
},
|
||||
swatch: {
|
||||
padding: '4px',
|
||||
background: '#fff',
|
||||
@ -72,22 +66,22 @@ export default class ColorPicker extends Component<ColorPickerProps> {
|
||||
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
|
||||
display: 'inline-block',
|
||||
cursor: 'pointer',
|
||||
} as React.CSSProperties,
|
||||
},
|
||||
popover: {
|
||||
position: 'absolute',
|
||||
zIndex: 10,
|
||||
} as React.CSSProperties,
|
||||
},
|
||||
cover: {
|
||||
position: 'fixed',
|
||||
top: '0px',
|
||||
right: '0px',
|
||||
bottom: '0px',
|
||||
left: '0px',
|
||||
} as React.CSSProperties,
|
||||
},
|
||||
wrapper: {
|
||||
position: 'inherit',
|
||||
zIndex: 100,
|
||||
} as React.CSSProperties,
|
||||
},
|
||||
};
|
||||
|
||||
if (position === 'top') {
|
||||
|
Loading…
Reference in New Issue
Block a user