lowcode-engine [Feature] lowcode-material-parser 建议暴露 react-docgen-typescript Parser的配置

4bbkushb  于 2023-02-04  发布在  React
关注(0)|答案(1)|浏览(225)

背景

react-docgen-typescript会解析组件props包括这个props extend的interface. 例如你用antd Select自定义XXSelect, 不仅会解析出XXSelect的props还有antd select和rc-select. rc-select中大部分的props是不太可能在低代码编辑器上配置, 可以不生成.

实现建议

第二个参数可以传入配置, 过滤掉不想要的props
lowcode-engine/modules/material-parser/src/parse/ts/index.ts

Line 519 in d7132fa

| | constparser=newMyParser(program,{}); |

eg:

const parser = new MyParser(program, {
    propFilter: props => {
      // rc-xxx 组件的props太杂了,一般不会配置
      if (props?.parent?.fileName?.includes('rc-')) {
        return false;
      }
      return true;
    },
  });

建议 lowcode-material-parser 暴露这个配置

相关问题