/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/libs/datamanager/src/components/Common/Table/TableCheckbox.jsx
26 строк
932 B
Marcel Canu
feat: UTC-454: Shift click functionality for data manager tasks (#9067)
02 янв 2026, 17:29
Не верифицирован
02 янв 2026, 17:29
693b67c
Код
Авторство
О чём код?
import { Checkbox } from "@humansignal/ui"; const IndeterminateCheckbox = ({ checked, indeterminate, ...props }) => { return <Checkbox indeterminate={indeterminate && !checked} checked={checked} {...props} />; }; export const TableCheckboxCell = ({ checked, indeterminate, onChange, ariaLabel }) => { return ( <IndeterminateCheckbox type="checkbox" checked={checked ?? false} indeterminate={indeterminate ?? false} onChange={() => { // Intentionally empty - we handle everything in onClick to capture shiftKey }} onClick={(e) => { // Prevent native checkbox behavior - we control the state via React e.preventDefault(); // Capture shiftKey from the click event and pass to onChange // The new checked state is the opposite of current since click toggles onChange(!checked, e.shiftKey); }} ariaLabel={ariaLabel} /> ); };