alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.91k stars 980 forks source link

TableRender 在使用搜索栏是否折叠的时候,当展开折叠,Select 组件里的 options 会丢失 #1512

Open a850835125 opened 3 months ago

a850835125 commented 3 months ago

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

2.问题描述(Bug description): 在使用 TableRender 的时候,添加了 collapsed: true ,当折叠展开的时候,Select 组件里的 options 会丢失 3.出现问题的 schema demo(Reproduction schema demo)

export const schema = {
  type: 'object',
  properties: {
    handleNumber: {
      title: '受理号码',
      type: 'string',
    },
    managerPhone: {
      title: '客户经理号码',
      type: 'string',
    },
    agencyName: {
      title: '企业名称',
      type: 'string',
    },
    linkMan: {
      title: '企业联系人',
      type: 'string',
    },
    productCode: {
      title: '受理类型',
      type: 'string',
      widget: 'select',
    },
  }
}

4.最小复现 demo(Reproduction demo): export default () => { const tableHeight = useTableScroll({}); const tableRef = useRef() const onMount = async () => { const { data: productList } = await getProductList() const tags = tagList.map(m => ({ label: m.tagsName, value: m.tagsId })) const channels = channelList.map((m: any) => ({ label: m.channelName, value: m.channelId })) tableRef.current.form.setSchema({ productCode: { props: { options: [...productList] } } }) }

return ( <TableRender ref={tableRef} search={{ schema, onMount, collapsed: true, defaultCollapsed: true, widgets: { AreaSelect }, column: 3}} columns={columns} request={getOrderList} scroll={{ y: tableHeight, }} rowKey="orderId" /> ); };

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