feat(input): support native color picker - #111
Merged
Merged
Conversation
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

变更说明
为 GenUI
input组件增加原生颜色选择支持,对应 #103。此前
inputType白名单仅支持text、email和password,即使渲染层已经将inputType直接透传给原生<input>,color仍会在协议校验 / repair 阶段被过滤。本 PR 增加
inputType: "color"支持,并继续复用浏览器原生 color picker,不引入额外组件或依赖。主要改动:
GenuiInput.inputType增加colorINPUT_TYPES白名单增加colorInputNode的原生<input type="color">渲染方式id持久化和 siblingsubmit的fields收集机制64 × 40px,避免继承普通文本输入框的全宽样式color用法,并约定颜色值使用#RRGGBB示例
{ "type": "input", "inputType": "color", "label": "主色", "id": "c_primary", "value": "#1A3A5C" }用户选择颜色后,现有 submit 机制会收集:
{ "fields": { "c_primary": "#ff0000" } }设计取舍
本次仅支持浏览器原生 color picker:
swatch组件保持本次修改为一个最小的协议扩展。
测试
覆盖:
inputType: "color"能通过 runtime validationcolorinput[type="color"]fieldsCloses #103