You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mobile UX (round 3): when the host form passes mobileFullscreen (or the field schema sets mobile_fullscreen: true), an "expand" affordance opens a fullscreen edit dialog
实现读了四条来源:
constshowFullscreenButton=Boolean((propsasany).mobileFullscreen??// ① camelCase proptextareaField?.mobile_fullscreen??// ② 字段元数据(propsasany).mobile_fullscreen??// ③ snake_case prop(propsasany).schema?.mobile_fullscreen,// ④ schema 载体);
在 objectui#3221(给
FieldWidgetComponentProps去掉[key: string]: any)时发现,不在该 PR 修。现象
packages/fields/src/widgets/TextAreaField.tsx的文档注释声称:实现读了四条来源:
全仓 grep 之后:
mobileFullscreen(camelCase)没有任何生产者。 唯一出现该拼写的地方就是 TextAreaField 自己(读取处 + 第 57 行的解构剥离)。注释里的"宿主表单传入"从未成立。mobile_fullscreen作为 prop 也到不了:form.tsx的stripRegisteredFieldProps()明确把mobile_fullscreen和fullscreen从转发给已注册 widget 的 props 里剔除(第 266-267 行)。packages/plugin-form/src/ObjectForm.tsx:1049:{ ...f, mobile_fullscreen: true },写在字段元数据上。后果
不是运行时 bug(功能经 ② 正常工作),而是三个可维护性问题:
mobileFullscreen/mobile_fullscreen两种拼写并存,恰好是主令 [WIP] Enhance UI components for forms and layouts #12 说的那种应该在生产者收敛、而不是在消费者用??累积的情况。建议
保留 ②(元数据是唯一真实生产者),删除 ①③④,并把注释改成描述真实来源。如果确实需要「宿主强制全屏」的 prop 覆盖能力,那就明确声明一个键并让某个宿主真的传它 —— 而不是三个拼写都读、都没人写。
为什么现在才能看见
FieldWidgetComponentProps当时以[key: string]: any结尾,(props as any).mobileFullscreen是完全合法的读取,类型any,运行时恒undefined。objectui#3221 收紧类型后,这类「读了但没人写」的键才可能被追问。关联:objectui#3221、objectui#3161。