From 2efe5803e18645048767f6eb323f278daded9635 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 19 Sep 2023 14:05:29 +0800 Subject: [PATCH] type: fix IconTagType issue. --- packages/react-button/src/index.tsx | 4 ++-- packages/react-collapse/src/Panel.tsx | 4 ++-- packages/react-input/src/index.tsx | 4 ++-- .../react-overlay-trigger/src/util/getBoundingClientRect.ts | 2 +- packages/react-overlay-trigger/src/util/getClientRect.ts | 2 +- packages/react-overlay-trigger/src/util/getWindowSizes.ts | 2 +- packages/react-progress/src/utils.tsx | 4 ++-- packages/react-steps/src/Step.tsx | 4 ++-- packages/react-table/src/ThComponent.tsx | 4 ++-- packages/react-table/src/index.tsx | 2 +- packages/react-tree/src/TreeNode.tsx | 5 +++-- packages/react-tree/src/index.tsx | 4 ++-- 12 files changed, 21 insertions(+), 20 deletions(-) diff --git a/packages/react-button/src/index.tsx b/packages/react-button/src/index.tsx index 24ed05eced..9a65282634 100644 --- a/packages/react-button/src/index.tsx +++ b/packages/react-button/src/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Icon, { IconProps } from '@uiw/react-icon'; +import Icon, { IconProps, IconTagType } from '@uiw/react-icon'; import { IProps, HTMLButtonProps } from '@uiw/utils'; import './style/index.less'; @@ -12,7 +12,7 @@ export interface ButtonProps extends IProps, Omit { active?: boolean; loading?: boolean; block?: boolean; - icon?: IconProps['type']; + icon?: IconProps['type']; type?: ButtonType; size?: ButtonSize; htmlType?: 'button' | 'submit' | 'reset'; diff --git a/packages/react-collapse/src/Panel.tsx b/packages/react-collapse/src/Panel.tsx index cdfd73b2ff..4b9269fd3f 100644 --- a/packages/react-collapse/src/Panel.tsx +++ b/packages/react-collapse/src/Panel.tsx @@ -2,14 +2,14 @@ import React from 'react'; import { CSSTransition } from 'react-transition-group'; import { TransitionStatus } from 'react-transition-group/Transition'; import { IProps, HTMLDivProps } from '@uiw/utils'; -import Icon, { IconProps } from '@uiw/react-icon'; +import Icon, { IconProps, IconTagType } from '@uiw/react-icon'; export interface CollapsePanelProps extends IProps, HTMLDivProps { disabled?: boolean; showArrow?: boolean; isActive?: boolean; header?: React.ReactNode; - icon?: IconProps['type']; + icon?: IconProps['type']; extra?: React.ReactNode; onItemClick?: (evn: React.MouseEvent) => void; } diff --git a/packages/react-input/src/index.tsx b/packages/react-input/src/index.tsx index 273ea82707..2f460bd17f 100644 --- a/packages/react-input/src/index.tsx +++ b/packages/react-input/src/index.tsx @@ -1,12 +1,12 @@ import React, { useEffect, useImperativeHandle } from 'react'; -import Icon, { IconProps } from '@uiw/react-icon'; +import Icon, { IconProps, IconTagType } from '@uiw/react-icon'; import { IProps, HTMLInputProps } from '@uiw/utils'; import './style/input.less'; export * from './InputNumber'; export { default as InputNumber } from './InputNumber'; export interface InputProps extends IProps, Omit { - preIcon?: IconProps['type']; + preIcon?: IconProps['type']; addonAfter?: React.ReactNode; size?: 'large' | 'default' | 'small'; inputStyle?: React.CSSProperties; diff --git a/packages/react-overlay-trigger/src/util/getBoundingClientRect.ts b/packages/react-overlay-trigger/src/util/getBoundingClientRect.ts index 4670873cff..077225953c 100644 --- a/packages/react-overlay-trigger/src/util/getBoundingClientRect.ts +++ b/packages/react-overlay-trigger/src/util/getBoundingClientRect.ts @@ -5,7 +5,7 @@ import getWindowSizes, { WindowSize } from './getWindowSizes'; import getClientRect from './getClientRect'; import isIE from './isIE'; -export interface IBoundingClientRect { +export interface IBoundingClientRect extends DOMRect { left: number; right: number; top: number; diff --git a/packages/react-overlay-trigger/src/util/getClientRect.ts b/packages/react-overlay-trigger/src/util/getClientRect.ts index 8b5daf0627..02c25cbbb2 100644 --- a/packages/react-overlay-trigger/src/util/getClientRect.ts +++ b/packages/react-overlay-trigger/src/util/getClientRect.ts @@ -5,7 +5,7 @@ * @argument {Object} offsets * @returns {Object} ClientRect like output */ -export default function getClientRect(offsets: ClientRect): ClientRect { +export default function getClientRect(offsets: DOMRect): DOMRect { return { ...offsets, right: offsets.left + offsets.width, diff --git a/packages/react-overlay-trigger/src/util/getWindowSizes.ts b/packages/react-overlay-trigger/src/util/getWindowSizes.ts index 123f59d837..527b932a85 100644 --- a/packages/react-overlay-trigger/src/util/getWindowSizes.ts +++ b/packages/react-overlay-trigger/src/util/getWindowSizes.ts @@ -20,7 +20,7 @@ function getSize(axis: 'Height' | 'Width', body: BodyElement, html: IHTMLElement html[`offset${axis}`], html[`scroll${axis}`], isIE(10) - ? parseInt(html[`offset${axis}`], 10) + + ? parseInt(html[`offset${axis}` as keyof IHTMLElement], 10) + parseInt(computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`], 10) + parseInt(computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`], 10) : 0, diff --git a/packages/react-progress/src/utils.tsx b/packages/react-progress/src/utils.tsx index f5730901b4..ddbee46db4 100644 --- a/packages/react-progress/src/utils.tsx +++ b/packages/react-progress/src/utils.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import Icon, { IconProps } from '@uiw/react-icon'; +import Icon, { IconProps, IconTagType } from '@uiw/react-icon'; -export function IconProgress(props: { type: IconProps['type'] }): JSX.Element { +export function IconProgress(props: { type: IconProps['type'] }): JSX.Element { return ; } diff --git a/packages/react-steps/src/Step.tsx b/packages/react-steps/src/Step.tsx index 112b94b361..117658a542 100644 --- a/packages/react-steps/src/Step.tsx +++ b/packages/react-steps/src/Step.tsx @@ -1,5 +1,5 @@ import React, { CSSProperties } from 'react'; -import Icon, { IconProps, IconsName } from '@uiw/react-icon'; +import Icon, { IconProps, IconsName, IconTagType } from '@uiw/react-icon'; import { IProps, HTMLDivProps } from '@uiw/utils'; import './style/index.less'; @@ -11,7 +11,7 @@ export interface StepProps extends IProps, Omit { itemWidth?: number; stepNumber?: string; adjustMarginRight?: number; - icon?: IconProps['type']; + icon?: IconProps['type']; } export default function Step(props: StepProps) { diff --git a/packages/react-table/src/ThComponent.tsx b/packages/react-table/src/ThComponent.tsx index b5dc8628f8..e1ae77ea0c 100644 --- a/packages/react-table/src/ThComponent.tsx +++ b/packages/react-table/src/ThComponent.tsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { TableColumns, TableProps, LocationWidth } from './'; import { locationFixed } from './util'; -interface ThComponentProps { +interface ThComponentProps { colNum: number; rightNum: number; item: TableColumns; @@ -13,7 +13,7 @@ interface ThComponentProps { locationWidth: { [key: string]: LocationWidth }; updateLocation: (params: LocationWidth, index: string, key: string, colSpan?: number) => void; } -export default class ThComponent extends Component> { +export default class ThComponent extends Component> { wrapper = React.createRef(); componentDidMount() { this.props.updateLocation( diff --git a/packages/react-table/src/index.tsx b/packages/react-table/src/index.tsx index 8395e39edb..c9c1b456a0 100644 --- a/packages/react-table/src/index.tsx +++ b/packages/react-table/src/index.tsx @@ -166,7 +166,7 @@ export default function Table(props: TablePro const arr1: Array = []; const arr = params.map((it: T, index: number) => { if (Array.isArray(it[childKey])) { - arr1.push(...deep(it[childKey])); + arr1.push(...deep(it[childKey] as TableColumns)); } return rowKey ? it[rowKey] : index; }); diff --git a/packages/react-tree/src/TreeNode.tsx b/packages/react-tree/src/TreeNode.tsx index 5bd0fb3760..9dcab46c63 100644 --- a/packages/react-tree/src/TreeNode.tsx +++ b/packages/react-tree/src/TreeNode.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useMemo } from 'react'; import { CSSTransition } from 'react-transition-group'; -import Icon, { IconProps } from '@uiw/react-icon'; +import Icon, { IconProps, IconTagType } from '@uiw/react-icon'; import { IProps, noop } from '@uiw/utils'; import { TreeData, TreeProps, getChildKeys } from './'; @@ -18,7 +18,8 @@ interface DisabledObj { disabledClass?: string; disabledStyle?: React.CSSProperties; } -interface TreeNodeProps IconProps['type']> extends IProps { +interface TreeNodeProps IconProps['type']> + extends IProps { data: TreeData[]; level: number; parent?: TreeData; diff --git a/packages/react-tree/src/index.tsx b/packages/react-tree/src/index.tsx index aa8db273f5..949d6f1afc 100644 --- a/packages/react-tree/src/index.tsx +++ b/packages/react-tree/src/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { IconProps } from '@uiw/react-icon'; +import { IconProps, IconTagType } from '@uiw/react-icon'; import { IProps, HTMLDivProps, noop } from '@uiw/utils'; import TreeNode from './TreeNode'; import './style/index.less'; @@ -16,7 +16,7 @@ export type TreeRenderTitleNode = { }; export interface TreeProps extends IProps, Omit { - icon?: IconProps['type']; + icon?: IconProps['type']; data?: TreeData[]; openKeys?: TreeData['key'][]; selectedKeys?: TreeData['key'][];