alibaba / lowcode-engine

An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
https://lowcode-engine.cn
MIT License
14.63k stars 2.55k forks source link

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

Open eightHundreds opened 1 year ago

eightHundreds commented 1 year ago

背景

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

实现建议

第二个参数可以传入配置, 过滤掉不想要的props https://github.com/alibaba/lowcode-engine/blob/d7132fa027d1e919de161b70e07a1cba728da7ea/modules/material-parser/src/parse/ts/index.ts#L519

eg:

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

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

eightHundreds commented 1 year ago

白嫖党, 不pr