From b0467c74f157b97d3dc3189e3b263dcf2763a74e Mon Sep 17 00:00:00 2001 From: "Water.Li" Date: Sun, 24 Dec 2023 19:01:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3antd=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84tablebug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react-antd-materials/package.json | 2 +- .../src/materials/datas/Table/designer/index.tsx | 5 +++-- .../react-antd-materials/src/materials/datas/Table/index.ts | 4 ++-- packages/rxeditor/react-core/package.json | 2 +- .../src/ComponentTreeWidget/ComponentDesignerView.tsx | 1 + packages/rxeditor/react-core/src/hocs/types.ts | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/react-antd-materials/package.json b/packages/react-antd-materials/package.json index 54d57785f..65b93c095 100644 --- a/packages/react-antd-materials/package.json +++ b/packages/react-antd-materials/package.json @@ -1,6 +1,6 @@ { "name": "@rxdrag/react-antd-materials", - "version": "0.6.1", + "version": "0.6.2", "module": "index.ts", "files": [ "dist" diff --git a/packages/react-antd-materials/src/materials/datas/Table/designer/index.tsx b/packages/react-antd-materials/src/materials/datas/Table/designer/index.tsx index ab5e848c8..142487bf2 100644 --- a/packages/react-antd-materials/src/materials/datas/Table/designer/index.tsx +++ b/packages/react-antd-materials/src/materials/datas/Table/designer/index.tsx @@ -2,9 +2,9 @@ import { IFieldMeta } from "@rxdrag/fieldy"; import { TableProps } from "@rxdrag/react-antd-components"; import { useNode, useTreeNodes, ComponentDesignerView } from "@rxdrag/react-core"; import { Table } from "antd"; -import { forwardRef, memo, useMemo } from "react" +import { Ref, forwardRef, memo, useMemo } from "react" -export const TableDesigner = memo(forwardRef(( +export const TableDesigner = memo(forwardRef(( props: TableProps, ref ) => { @@ -43,6 +43,7 @@ export const TableDesigner = memo(forwardRef(( return ( { const handleRef = useCallback((element: HTMLElement | undefined) => { for (const key of Object.keys(node?.rxProps || {})) { if (isHTMLElement(element) && !locked) { + console.log("===> handleRef", node?.meta?.componentName, element) element?.setAttribute(key, (node?.rxProps as any)[key]) } } diff --git a/packages/rxeditor/react-core/src/hocs/types.ts b/packages/rxeditor/react-core/src/hocs/types.ts index 1f5cf1dd8..ea4ff9d86 100644 --- a/packages/rxeditor/react-core/src/hocs/types.ts +++ b/packages/rxeditor/react-core/src/hocs/types.ts @@ -1,4 +1,4 @@ //antd组件的ref,有时候不是HTMLElement -export type Callback = (element?: HTMLElement | unknown) => HTMLElement | unknown; -export const defaultCallback = (element?: HTMLElement | unknown): HTMLElement | unknown => element || null; +export type Callback = (element?: HTMLElement | null) => HTMLElement | null | undefined; +export const defaultCallback = (element?: HTMLElement | null): HTMLElement | null | undefined => element ;