Skip to content

Commit

Permalink
修正antd升级引起的tablebug
Browse files Browse the repository at this point in the history
  • Loading branch information
codebdy committed Dec 24, 2023
1 parent 77bbf9d commit b0467c7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/react-antd-materials/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxdrag/react-antd-materials",
"version": "0.6.1",
"version": "0.6.2",
"module": "index.ts",
"files": [
"dist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLDivElement>((
export const TableDesigner = memo(forwardRef<any | undefined>((
props: TableProps,
ref
) => {
Expand Down Expand Up @@ -43,6 +43,7 @@ export const TableDesigner = memo(forwardRef<HTMLDivElement>((

return (
<Table
id="ttt"
ref={ref}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
columns={columns as any}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Table } from "@rxdrag/react-antd-components";
import { IMaterial } from "@rxdrag/react-core";
import { IMaterial, forwardRefById } from "@rxdrag/react-core";
import { FooterMaterial } from "../../common/Footer";
import { HeaderMaterial } from "../../common/Header";
import { TableSummaryMaterial } from "../TableSummary";
Expand All @@ -12,7 +12,7 @@ const name = "Table"
export const TableMaterial: IMaterial = {
componentName: name,
component: Table,
designer: TableDesigner,
designer: forwardRefById(TableDesigner),
designerLocales: locales,
propsSchema: materialSchema,
designerProps: {
Expand Down
2 changes: 1 addition & 1 deletion packages/rxeditor/react-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rxdrag/react-core",
"version": "0.6.1",
"version": "0.6.2",
"module": "index.ts",
"files": [
"dist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ComponentDesignerView = memo((props: { nodeId: string }) => {
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])
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/rxeditor/react-core/src/hocs/types.ts
Original file line number Diff line number Diff line change
@@ -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 ;

0 comments on commit b0467c7

Please sign in to comment.