tanbowensg

Results 23 comments of tanbowensg

可以的。不过交互上可能不会用键盘,添加复制按钮更好一点。

Good issue! It is truely confusing. The behaviors are diffrent after reopen modal. We should make sure the behaviors are the same --either showing error text on first render, or...

There is another factor to be consider. When user change property in form, do we have to convert the value of input to number or boolean?

It's a bug. Chakra-ui has a sizeMap, some number will be converted to a particular size.

了解,这里确实可以优化一下

很不错,我们确实打算这样替换。一开始用exampleProperties是个临时方案,当时不知道typebox有这个用法。

@MrWindlike 说的有道理。理论上来说,exampleProperties 和 default value 确实可以不同。exampleProperties 可能会为了展示效果更佳复杂花哨一点,而default value应该是尽量简洁的。 但是我们目前有个函数`generateDefaultValueFromSpec`,作用就是根据 Typebox 类型生成一个默认值,这个一定程度上起到了defaultValue的作用。但是由于这个函数一般就是用来初始化和校验数据结构类型用的,所以对defaultValue具体值是什么没有要求,比如string类型就给个`''`,number类型就给个`0`。反过来说,一个花哨的exampleProperties在这些场景中也不会有什么坏处。所以对于需要简洁的default value场景,我们可以继续用这个函数满足。 而且exampleProperties目前只是针对component的properties的,但是实际上所有用Typebox声明的地方都有这个需求。比如component的 state、trait的property和state,还有method的parameters等等 所以,我觉得把 exampleProperties 还是应该放到 defaultValue 中,但是全面替换这个有一定工作量。

我整理下来sunmao现在其实有两个问题是需要解决的: 1. 假如有一个字符串的数组,sunmao现在新增数组元素的时候,只能自动新增一个空字符串,不能新增一个自定义的字符串。这个功能用 default 实现比较合适。 2. exampleProperties 只支持 component 的 property。但是 trait 的 property 也需要 default Value,state、method和slotProps可能也需要。这么看来,default value 是用到typebox的地方就应该有的,但是exampleProperties可能只有component和trait才需要。 所以结论可能是exampleProperties还是需要保留的,但是default Value也需要加,两者功能不同。

Good catch. Our `API` data source is very basic for now. It can work, but everything need to be set be user manually. In this case, user has to set...

I could because you use expressions in api. Everytime expression value changes, the api will run and the request will be sent. I you need to control the timing of...