Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@xrenders/schema-builder 使用后布局错误 #1522

Open
canyuegongzi opened this issue May 15, 2024 · 2 comments
Open

@xrenders/schema-builder 使用后布局错误 #1522

canyuegongzi opened this issue May 15, 2024 · 2 comments
Assignees

Comments

@canyuegongzi
Copy link

1.依赖仓库的版本(Dependencies versions)

  • react:18
  • form-render:
  • table-render:
  • antd:

2.问题描述(Bug description)
使用@xrenders/schema-builder 后页面布局错误 感觉是编辑器的定位有问题
image

3.出现问题的 schema demo(Reproduction schema demo)

const FormContent = forwardRef((_props, _ref) => {

  const [config, setConfig] = useState({
    importBtn: true,
    exportBtn: true,
    pubBtn: false,
    clearBtn: true,
    saveBtn: true
  })

  const [schema, setSchema] = useState({})

  const designRef = useRef<any>();

  useImperativeHandle(_ref, (): FormContentHandler => {
    return {
      setValue: async (_value: Record<any, any>) => {
        setSchema(_value)
        designRef?.current.setValue?.(_value);
        return Promise.resolve(true)
      },
      getValue: async () =>{
        return await designRef?.current.getValue?.();
      },
      updateConfig: async (value: Record<any, any>) => {
        setConfig({...config, ...value});
        return Promise.resolve(true)
      },
      designFun: async (api: string, ...args: any) => {
        const apiVal = (designRef?.current as any)[api]
        if (apiVal) {
          if (typeof apiVal === 'function') {
            return apiVal(...args)
          }
          return apiVal
        }
        return null;
      }
    }
  })
  return (
    <SchemaBuilder
      defaultValue={schema}
      ref={designRef}
      {...config}
    />
  )
})
<div style={{width: '100vw', height: '90vh'}}>
      <Example/>
    </div>

4.最小复现 demo(Reproduction demo)

form-render demo https://codesandbox.io/s/unruffled-flower-jl78h
table-render demo https://codesandbox.io/s/sweet-euler-bdoty
fr-generator demo https://codesandbox.io/s/s13sh

@canyuegongzi
Copy link
Author

@xrenders/schema-builder": "1.0.0-alpha.13

@canyuegongzi
Copy link
Author

曲线救国 只能通过 css 隐藏掉
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants