From 07c5b6adcd57b9ad1e59d65eb70e2855aa22fa91 Mon Sep 17 00:00:00 2001 From: Lukas Harbarth Date: Fri, 25 Sep 2020 14:24:42 +0200 Subject: [PATCH] fix(CommonProps): add type definitions for HTML attributes (#692) --- packages/main/src/components/AnalyticalTable/index.tsx | 4 +--- packages/main/src/components/FilterBar/index.tsx | 1 + packages/main/src/components/FilterItem/index.tsx | 2 +- packages/main/src/components/VariantManagement/index.tsx | 3 ++- packages/main/src/interfaces/CommonProps.ts | 4 ++-- packages/main/src/internal/withWebComponent.tsx | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/main/src/components/AnalyticalTable/index.tsx b/packages/main/src/components/AnalyticalTable/index.tsx index 8551c354378..5bb1e87ee92 100644 --- a/packages/main/src/components/AnalyticalTable/index.tsx +++ b/packages/main/src/components/AnalyticalTable/index.tsx @@ -52,7 +52,7 @@ import { TitleBar } from './TitleBar'; import { orderByFn } from './util'; import { VirtualTableBody } from './virtualization/VirtualTableBody'; -export interface TableProps extends CommonProps { +export interface TableProps extends Omit { /** * Please look at the [AnalyticalTableColumnDefinition interface](#column-properties) for a full list of options. */ @@ -213,8 +213,6 @@ const AnalyticalTable: FC = forwardRef((props: TableProps, ref: Ref< setColumnOrder, dispatch, totalColumnsWidth, - toggleRowSelected, - toggleAllRowsSelected, setGroupBy } = useTable( { diff --git a/packages/main/src/components/FilterBar/index.tsx b/packages/main/src/components/FilterBar/index.tsx index 4c1c110e4c6..cad18de7130 100644 --- a/packages/main/src/components/FilterBar/index.tsx +++ b/packages/main/src/components/FilterBar/index.tsx @@ -275,6 +275,7 @@ const FilterBar: FC = forwardRef((props: FilterBarPropTypes, child.props.children?.props?.children?.map((item) => item.props.selected).join(',') !== prevChildren?.current?.[child.key]?.children?.map((item) => item.props.selected).join(',')) ) { + // @ts-ignore const { [child.key]: omit, ...rest } = dialogRefs; setDialogRefs(rest); } diff --git a/packages/main/src/components/FilterItem/index.tsx b/packages/main/src/components/FilterItem/index.tsx index d88a232db60..66003c20b79 100644 --- a/packages/main/src/components/FilterItem/index.tsx +++ b/packages/main/src/components/FilterItem/index.tsx @@ -16,7 +16,7 @@ import React, { FC, forwardRef, ReactNode, RefObject, useEffect, useMemo } from import { CommonProps } from '../../interfaces/CommonProps'; import styles from './FilterItem.jss'; -export interface FilterItemPropTypes extends CommonProps { +export interface FilterItemPropTypes extends Omit { placeholder?: string; type?: FilterType; label?: string; diff --git a/packages/main/src/components/VariantManagement/index.tsx b/packages/main/src/components/VariantManagement/index.tsx index d52efa0e6fa..811054fb891 100644 --- a/packages/main/src/components/VariantManagement/index.tsx +++ b/packages/main/src/components/VariantManagement/index.tsx @@ -27,7 +27,8 @@ export interface VariantItem { label: string; } -export interface VariantManagementPropTypes extends CommonProps { + +export interface VariantManagementPropTypes extends Omit { /** * Determines on which side the VariantManagement popover is placed at. */ diff --git a/packages/main/src/interfaces/CommonProps.ts b/packages/main/src/interfaces/CommonProps.ts index b23baf4ade7..1bf7cf2bbda 100644 --- a/packages/main/src/interfaces/CommonProps.ts +++ b/packages/main/src/interfaces/CommonProps.ts @@ -1,6 +1,6 @@ -import { CSSProperties, Ref } from 'react'; +import { CSSProperties, Ref, HTMLAttributes } from 'react'; -export interface CommonProps { +export interface CommonProps extends HTMLAttributes { /** * Element style which will be appended to the most outer element of a component. * Use this prop carefully, some css properties might break the component. diff --git a/packages/main/src/internal/withWebComponent.tsx b/packages/main/src/internal/withWebComponent.tsx index b0af01d52f4..2e4addfa28b 100644 --- a/packages/main/src/internal/withWebComponent.tsx +++ b/packages/main/src/internal/withWebComponent.tsx @@ -23,7 +23,7 @@ const createEventPropName = (eventName) => `on${capitalizeFirstLetter(kebabToCam type EventHandler = (event: CustomEvent) => void; -export interface WithWebComponentPropTypes extends CommonProps, HTMLAttributes { +export interface WithWebComponentPropTypes extends CommonProps { ref?: Ref; children?: any | void; }