<commit_before>
import React, { Component } from 'react';
import PropTypes from 'utils/PropTypes';
import { propTypes as MobxPropTypes } from 'mobx-react';
import withActions from 'utils/withActions';
import { Button } from 'antd';
import LinkButton from 'components/LinkButton';
import { TOOLBAR } from 'constants/Issuers';

@withActions
export default class RemoveButton extends Component {
	static propTypes = {
		children: PropTypes.node,
		recordKeys: PropTypes.array,
		label: PropTypes.node,
		multiLabel: PropTypes.node,
		actions: PropTypes.shape({
			requestRemove: PropTypes.func.isRequired,
			selectedKeys: MobxPropTypes.observableArray.isRequired,
		}).isRequired,
		component: PropTypes.component,
	};

	static defaultProps = {
		label: '删除',
		multiLabel: '批量删除',
		type: 'primary',
		recordKeys: [],
		component: LinkButton,
	};

	static contextTypes = {
		issuer: PropTypes.string,
	};

	static LinkButton = LinkButton;

	_handleClick = (ev) => {
		ev.preventDefault();
		const { recordKeys, actions } = this.props;
		actions.requestRemove(recordKeys);
	};

	render() {
		const {
			props: {
				actions: { selectedKeys },
				component, recordKeys, children, label, multiLabel, ...other,
			},
			context: { issuer },
		} = this;

		const selectedLength = recordKeys.length || selectedKeys.length;
		const isInToolbar = issuer === TOOLBAR;
		const Comp = isInToolbar ? Button : component;

		return (
			<Comp
				onClick={this._handleClick}
				{...other}
				disabled={!selectedLength}
			>
				{(selectedLength > 1 ? multiLabel : label) || children}
			</Comp><commit_msg>update RemoveButton style<commit_after>
import React, { Component } from 'react';
import PropTypes from 'utils/PropTypes';
import { propTypes as MobxPropTypes } from 'mobx-react';
import withActions from 'utils/withActions';
import { Button } from 'antd';
import LinkButton from 'components/LinkButton';
import { TOOLBAR } from 'constants/Issuers';

@withActions
export default class RemoveButton extends Component {
	static propTypes = {
		children: PropTypes.node,
		recordKeys: PropTypes.array,
		label: PropTypes.node,
		multiLabel: PropTypes.node,
		actions: PropTypes.shape({
			requestRemove: PropTypes.func.isRequired,
			selectedKeys: MobxPropTypes.observableArray.isRequired,
		}).isRequired,
		component: PropTypes.component,
	};

	static defaultProps = {
		label: '删除',
		multiLabel: '批量删除',
		recordKeys: [],
		component: LinkButton,
	};

	static contextTypes = {
		issuer: PropTypes.string,
	};

	static LinkButton = LinkButton;

	_handleClick = (ev) => {
		ev.preventDefault();
		const { recordKeys, actions } = this.props;
		actions.requestRemove(recordKeys);
	};

	render() {
		const {
			props: {
				actions: { selectedKeys },
				component, recordKeys, children, label, multiLabel, ...other,
			},
			context: { issuer },
		} = this;

		const selectedLength = recordKeys.length || selectedKeys.length;
		const isInToolbar = issuer === TOOLBAR;
		const Comp = isInToolbar ? Button : component;
		const styleTypes = {};
		if (Comp.name === 'Button') { styleTypes.type = 'danger'; }

		return (
			<Comp
				onClick={this._handleClick}
				{...styleTypes}
				{...other}
				disabled={!selectedLength}
			>
				{(selectedLength > 1 ? multiLabel : label) || children}
			</Comp>
{'fraction_non_alphanumeric': 0.12712895377128955, 'fraction_numerical': 0.0006082725060827251, 'mean_word_length': 4.075617283950617, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2747773', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1020, 'n_words': 251}