Skip to content

Commit 9e8d391

Browse files
author
Illia Obukhau
committed
refactor(datagrid-web): exclude undefined from SelectionHelper type
1 parent d86971d commit 9e8d391

File tree

2 files changed

+5
-5
lines changed
  • packages
    • pluggableWidgets/datagrid-web/src/features
    • shared/pluggable-widgets-commons/src/selection

2 files changed

+5
-5
lines changed

packages/pluggableWidgets/datagrid-web/src/features/selection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const defaultProps: SelectActionProps = {
1717
isSelected: () => false
1818
};
1919

20-
export function useOnSelectProps(selection: SelectionHelper): SelectActionProps {
20+
export function useOnSelectProps(selection: SelectionHelper | undefined): SelectActionProps {
2121
return useMemo(() => {
2222
if (!selection) {
2323
return defaultProps;
@@ -59,7 +59,7 @@ type SelectionSettings = {
5959
selectionMethod: SelectionMethod;
6060
};
6161

62-
export function selectionSettings(props: SelectionProps, helper: SelectionHelper): SelectionSettings {
62+
export function selectionSettings(props: SelectionProps, helper: SelectionHelper | undefined): SelectionSettings {
6363
const { itemSelection, itemSelectionMethod, showSelectAllToggle } = props;
6464
const isDesignMode = typeof itemSelection === "string";
6565
const selectionOn = itemSelection !== undefined && itemSelection !== "None";

packages/shared/pluggable-widgets-commons/src/selection/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function useSelectionHelper(
6565
selection: SelectionSingleValue | SelectionMultiValue | undefined,
6666
dataSource: ListValue,
6767
onSelectionChange: ActionValue | undefined
68-
): SelectionHelper {
68+
): SelectionHelper | undefined {
6969
const firstLoadDone = useRef(false);
7070
useEffect(() => {
7171
if (firstLoadDone.current) {
@@ -78,7 +78,7 @@ export function useSelectionHelper(
7878
}
7979
}, [dataSource?.status]);
8080

81-
const selectionHelper = useRef<SelectionHelper>(undefined);
81+
const selectionHelper = useRef<SelectionHelper | undefined>(undefined);
8282

8383
if (selection !== undefined) {
8484
if (selection.type === "Single") {
@@ -101,5 +101,5 @@ export function useSelectionHelper(
101101

102102
export type { SingleSelectionHelper };
103103
export type { MultiSelectionHelper };
104-
export type SelectionHelper = SingleSelectionHelper | MultiSelectionHelper | undefined;
104+
export type SelectionHelper = SingleSelectionHelper | MultiSelectionHelper;
105105
export type MultiSelectionStatus = "none" | "all" | "some";

0 commit comments

Comments
 (0)