Skip to content

Commit

Permalink
Renamed params (deephaven#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed May 21, 2024
1 parent 4f7272c commit 056a4f2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions plugins/ui/src/js/src/elements/spectrum/useSelectionProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,28 @@ export function useSelectionEventCallback(
/**
* Converts serialized selection props to props that can be passed to DHC
* components.
* @param props serialized selection props
* @param selectionMode selection mode (may be uppercase)
* @param onChange serialized selection change event handler
* @param onSelectionChange serialized selection change event handler
* @returns selection props
*/
export function useSelectionProps({
selectionMode,
onChange,
onSelectionChange,
selectionMode: selectionModeMaybeUppercase,
onChange: serializedOnChange,
onSelectionChange: serializedOnSelectionChange,
}: SerializedSelectionProps): SelectionProps {
const selectionModeLc = selectionMode?.toLowerCase() as SelectionMode;
const selectionModeLc =
selectionModeMaybeUppercase?.toLowerCase() as SelectionMode;

const serializedOnChange = useSelectionEventCallback(onChange);
const serializedOnSelectionChange =
useSelectionEventCallback(onSelectionChange);
const onChange = useSelectionEventCallback(serializedOnChange);
const onSelectionChange = useSelectionEventCallback(
serializedOnSelectionChange
);

return {
selectionMode: selectionModeLc,
onChange: onChange == null ? undefined : serializedOnChange,
onChange: serializedOnChange == null ? undefined : onChange,
onSelectionChange:
onSelectionChange == null ? undefined : serializedOnSelectionChange,
serializedOnSelectionChange == null ? undefined : onSelectionChange,
};
}

0 comments on commit 056a4f2

Please sign in to comment.