<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { useListContext } from '../context';
import ColumnChooserButton from '../../Toolbar/ColumnChooserButton';

function ColumnChooser(props) {
	const { columns, visibleColumns, setVisibleColumns } = useListContext();

	return (
		<ColumnChooserButton
			{...props}
			columns={columns.map(({ dataKey, label }, i) => ({
				key: dataKey,
				label,
				hidden: !visibleColumns?.includes(dataKey),
				order: i + 1,
			}))}
			onSubmit={(_, changes) => {
				setVisibleColumns(changes.filter(c => !c.hidden).map(c => c.key));
				if (props.onSubmit) {
					props.onSubmit(_, changes);
				}
			}}
		/>
	);
}<commit_msg>fix(List/ColumnChooser): let's defined its own columns (#3092)<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { useListContext } from '../context';
import ColumnChooserButton from '../../Toolbar/ColumnChooserButton';

function ColumnChooser(props) {
	const { columns, visibleColumns, setVisibleColumns } = useListContext();

	return (
		<ColumnChooserButton
			columns={columns.map(({ dataKey, label }, i) => ({
				key: dataKey,
				label,
				hidden: !visibleColumns?.includes(dataKey),
				order: i + 1,
			}))}
			{...props}
			onSubmit={(_, changes) => {
				setVisibleColumns(changes.filter(c => !c.hidden).map(c => c.key));
				if (props.onSubmit) {
					props.onSubmit(_, changes);
				}
			}}
		/>
	);
}
{'fraction_non_alphanumeric': 0.1686247408431237, 'fraction_numerical': 0.00414651002073255, 'mean_word_length': 3.763157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2148042', 'n_tokens_mistral': 545, 'n_tokens_neox': 457, 'n_words': 100}