writer / writer-framework

No-code in the front, Python in the back. An open-source framework for creating data apps.
https://dev.writer.com/framework/introduction
Apache License 2.0
1.31k stars 76 forks source link

custom component name should be constrained explicitely #517

Open ZBMO opened 1 month ago

ZBMO commented 1 month ago

Custom component names defined by the dev in custom_components/index.ts must contain the full original name of the component lower-case.

For example, A customized the Metric component called "customMetric", compiles but can't be dragged into the ComponentRenderer, whereas "custommetric" and "nonsensemetric" work fine. AFAIK the constraints for naming are not in the docs. video of the behavior from the invalid name is below

https://github.com/user-attachments/assets/4d9c69e6-5511-47be-90aa-d1f79447292e

FabienArcellier commented 1 month ago

I was able to reproduce this bug.

FabienArcellier commented 1 month ago

The problem comes from the DataTransfer protocol. Doing setData set the value in lowercase.

image

image

We need to know the component type for drag n drop. We cannot fully use the protocol because getData can only be used during drop, not on over. More about the limitation : https://stackoverflow.com/questions/28487352/dragndrop-datatransfer-getdata-empty

Solution proposal

FabienArcellier commented 1 month ago

We decide to go on raising error if id in custom_components/index use other character than [a-z]