pdfme / pdfme

A TypeScript based PDF generator library, made with React.
https://pdfme.com
MIT License
2.16k stars 192 forks source link

Move form-render dependency from common package to ui package #443

Open aaronmcdavid opened 2 months ago

aaronmcdavid commented 2 months ago

Is your feature request related to a problem? Please describe.

Alibab's form-render package has a set of dependencies that are both not current and not relevant to the generation of PDFs. To prevent the unnecessary incorporation of old, unused packages, this dependency can be moved closer to where it is needed.

Describe the solution you'd like

Move the form-render dependency out of the common package to the ui package. This also appears to entail a move of the types PropPanelSchema and PropPanelWidgetProps to the ui package. These seem to have no bearing on the common package.

Describe alternatives you've considered

I've also submitted a request to alibaba for them to update form-render, but it still includes a React color picker component, which doesn't seem necessary to generate PDFs.

Additional context

No response

hand-dot commented 2 months ago

ref: https://github.com/pdfme/pdfme/issues/410

hand-dot commented 2 months ago

Hey @aaronmcdavid ! Thank you for the suggestion. There have been reports of a similar issue in the past. I want to address this issue.

But the reason form-render is in the common package is because the schema package needs form-render's types for the definition of plugins it uses. And the schema package is used in the generator package.

I don't think our current approach is the best. As you said, there are dependencies that are not relevant to PDF generation, which is not good.

However, if we move it to the ui package, we need to think about how to use form-render's types in the schema package.

The most ideal solution would be for form-render to use the latest @rc-component/color-picker. Could we possibly wait for a response to your issue for a while?


ref: https://github.com/alibaba/x-render/issues/1496

sebimarkgraf commented 2 weeks ago

@hand-dot Did you consider vendoring the types from antd that are really needed in the common package?

This could allow your current approach while removing a lot of the issues that come from having antd installed completely