Skip to content

feat(ui): 新增列表选择 (UiListPicker) UI 组件#118

Open
woaiCarlos wants to merge 1 commit into
ChaoMixian:masterfrom
woaiCarlos:feat/ui-list-picker
Open

feat(ui): 新增列表选择 (UiListPicker) UI 组件#118
woaiCarlos wants to merge 1 commit into
ChaoMixian:masterfrom
woaiCarlos:feat/ui-list-picker

Conversation

@woaiCarlos

Copy link
Copy Markdown

概述

新增一个让用户从候选列表里挑选一个值的 UI 组件。底层使用 Material 3 的下拉菜单 (MaterialAutoCompleteTextView + TextInputLayout)。

模块 ID:vflow.ui.component.listpicker

参数

参数 类型 说明
key STRING 组件 ID / 变量名(必填)
label STRING, magicVar 选择框上方的标签
options STRING, magicVar 候选项,按换行符分隔
default_value STRING, magicVar 默认选中(按内容匹配,留空则取第一项)
trigger_event BOOLEAN 选中变化时是否触发事件

输出

  • component — VUiComponent 对象,暴露 .value(当前选中)、.options(全部候选)、.ispicker / .isinput / .istext 等类型判断
  • id — 组件唯一标识

改动

  • UiElement.kt:新增 LIST_PICKER 枚举 + 可选 options: List<String> 字段(带默认值,向后兼容 Parcelize 数据)
  • VUiComponent.ktasString() 处理 LIST_PICKER;新增 ispickeroptions 属性
  • DynamicUiRenderer.kt:渲染 LIST_PICKERMaterialAutoCompleteTextView + 下拉箭头),选中变化走 UiSessionBus.emitEvent
  • UiListPickerModule.kt:新模块
  • ModuleRegistry.kt:注册
  • 简体 / 英文 / 日文 strings_module.xml:补齐所有 label / desc / 输入文案
  • vtype_properties.xml:补齐 vtype_uicomponent_ispickervtype_uicomponent_options

测试

  • 新增 UiListPickerModuleTest,覆盖 parseOptions 全部行为
    • \n 分隔、空白裁剪、空行忽略、纯空白输入、\\n 转义
    • 模块 id、category、输入字段顺序、元数据 fallback
    • 9 个测试全部通过
  • 64 个现有测试无回归

截图/演示

触发条件示例:

  1. 添加"创建 Activity"模块
  2. 添加"列表选择"模块,optionsApple\nBanana\nCherry
  3. 再添加一个按钮用作提交
  4. 启动 Activity → 用户看到一个 Material 风格的下拉框,点击展开选择

🤖 Generated with MiniMax Code

新增一个让用户从候选列表里挑选一个值的 UI 组件,类似 Material 3 的下拉菜单。

模块 id: vflow.ui.component.listpicker
- key: 组件 ID / 变量名
- label: 选择框上方的标签
- options: 候选项,按换行符分隔
- default_value: 默认选中(按内容匹配,留空则取第一项)
- trigger_event: 选中变化时是否触发事件

输出:
- component: VUiComponent 对象 (含 .value 当前选中、.options 候选项列表)
- id: 组件唯一标识

实现细节:
- UiElement 新增 LIST_PICKER 枚举值 + 可选 options 字段 (默认 emptyList())
- DynamicUiRenderer 用 MaterialAutoCompleteTextView + 下拉箭头渲染
- 选中变化走 UiSessionBus 触发事件
- VUiComponent 暴露 ispicker、options 等属性
- 模块注册到 ModuleRegistry

测试:
- 新增 UiListPickerModuleTest 覆盖 parseOptions 全部行为
- 解析方式: \n、\n、空行忽略、首尾空白
- 模块元数据、id、输入顺序兜底
- 共 9 个测试通过,64 个现有测试仍全绿

国际化:
- 简体、繁体(隐含)/英文、日文 strings.xml 都补齐
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant