@@ -4,9 +4,9 @@ import { ListViewProps as DHListViewProps } from '@deephaven/components';
44import { ListViewProps as DHListViewJSApiProps } from '@deephaven/jsapi-components' ;
55import { ObjectViewProps } from './ObjectView' ;
66import {
7- SerializedSelectionEventCallback ,
8- useSelectionEventCallback ,
9- } from './spectrum/useSelectionEventCallback ' ;
7+ SerializedSelectionProps ,
8+ useSelectionProps ,
9+ } from './spectrum/useSelectionProps ' ;
1010
1111type Density = Required < DHListViewProps > [ 'density' ] ;
1212
@@ -25,22 +25,11 @@ type WrappedDHListViewProps = Omit<
2525 selectionMode ?: SelectionMode | Uppercase < SelectionMode > ;
2626} ;
2727
28- export interface SerializedListViewEventProps {
29- /** Handler that is called when selection changes */
30- onChange ?: SerializedSelectionEventCallback ;
31-
32- /**
33- * Handler that is called when the selection changes.
34- * @deprecated Use `onChange` instead
35- */
36- onSelectionChange ?: SerializedSelectionEventCallback ;
37- }
38-
3928export type SerializedListViewProps = (
4029 | WrappedDHListViewProps
4130 | WrappedDHListViewJSApiProps
4231) &
43- SerializedListViewEventProps ;
32+ SerializedSelectionProps ;
4433
4534/**
4635 * Wrap ListView props with the appropriate serialized event callbacks.
@@ -49,24 +38,24 @@ export type SerializedListViewProps = (
4938 */
5039export function useListViewProps ( {
5140 density,
52- selectionMode,
53- onChange,
54- onSelectionChange,
41+ selectionMode : selectionModeMaybeUppercase ,
42+ onChange : serializedOnChange ,
43+ onSelectionChange : serializedOnSelectionChange ,
5544 ...otherProps
5645} : SerializedListViewProps ) : DHListViewProps | WrappedDHListViewJSApiProps {
5746 const densityLc = density ?. toLowerCase ( ) as Density ;
58- const selectionModeLc = selectionMode ?. toLowerCase ( ) as SelectionMode ;
5947
60- const serializedOnChange = useSelectionEventCallback ( onChange ) ;
61- const serializedOnSelectionChange =
62- useSelectionEventCallback ( onSelectionChange ) ;
48+ const { selectionMode, onChange, onSelectionChange } = useSelectionProps ( {
49+ selectionMode : selectionModeMaybeUppercase ,
50+ onChange : serializedOnChange ,
51+ onSelectionChange : serializedOnSelectionChange ,
52+ } ) ;
6353
6454 return {
6555 density : densityLc ,
66- selectionMode : selectionModeLc ,
67- onChange : onChange == null ? undefined : serializedOnChange ,
68- onSelectionChange :
69- onSelectionChange == null ? undefined : serializedOnSelectionChange ,
56+ selectionMode,
57+ onChange,
58+ onSelectionChange,
7059 // The @deephaven /components `ListView` has its own normalization logic that
7160 // handles primitive children types (string, number, boolean). It also
7261 // handles nested children inside of `Item` and `Section` components, so
0 commit comments