mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-25 22:46:31 -04:00
@@ -5,20 +5,21 @@ import { SelectStateInputProps } from 'typings/props';
|
||||
import TableRowCell, { TableRowCellProps } from './TableRowCell';
|
||||
import styles from './TableSelectCell.css';
|
||||
|
||||
interface TableSelectCellProps extends Omit<TableRowCellProps, 'id'> {
|
||||
interface TableSelectCellProps<T extends number | string = number>
|
||||
extends Omit<TableRowCellProps, 'id'> {
|
||||
className?: string;
|
||||
id: number | string;
|
||||
id: T;
|
||||
isSelected?: boolean;
|
||||
onSelectedChange: (options: SelectStateInputProps) => void;
|
||||
onSelectedChange: (options: SelectStateInputProps<T>) => void;
|
||||
}
|
||||
|
||||
function TableSelectCell({
|
||||
function TableSelectCell<T extends number | string = number>({
|
||||
className = styles.selectCell,
|
||||
id,
|
||||
isSelected = false,
|
||||
onSelectedChange,
|
||||
...otherProps
|
||||
}: TableSelectCellProps) {
|
||||
}: TableSelectCellProps<T>) {
|
||||
const initialIsSelected = useRef(isSelected);
|
||||
const handleSelectedChange = useRef(onSelectedChange);
|
||||
|
||||
|
||||
@@ -7,22 +7,23 @@ import VirtualTableRowCell, {
|
||||
} from './VirtualTableRowCell';
|
||||
import styles from './VirtualTableSelectCell.css';
|
||||
|
||||
interface VirtualTableSelectCellProps extends VirtualTableRowCellProps {
|
||||
interface VirtualTableSelectCellProps<T extends number | string = number>
|
||||
extends VirtualTableRowCellProps {
|
||||
inputClassName?: string;
|
||||
id: number | string;
|
||||
id: T;
|
||||
isSelected?: boolean;
|
||||
isDisabled: boolean;
|
||||
onSelectedChange: (options: SelectStateInputProps) => void;
|
||||
onSelectedChange: (options: SelectStateInputProps<T>) => void;
|
||||
}
|
||||
|
||||
function VirtualTableSelectCell({
|
||||
function VirtualTableSelectCell<T extends number | string = number>({
|
||||
inputClassName = styles.input,
|
||||
id,
|
||||
isSelected = false,
|
||||
isDisabled,
|
||||
onSelectedChange,
|
||||
...otherProps
|
||||
}: VirtualTableSelectCellProps) {
|
||||
}: VirtualTableSelectCellProps<T>) {
|
||||
const handleChange = useCallback(
|
||||
({ value, shiftKey }: CheckInputChanged) => {
|
||||
onSelectedChange({ id, value, shiftKey });
|
||||
|
||||
Reference in New Issue
Block a user