Skip to content

feat: ConfigPanel disabledWhen, expandedSections, description spec alignment, navigation hints#805

Merged
hotlong merged 5 commits intomainfrom
copilot/fix-view-config-panel-issues
Feb 23, 2026
Merged

feat: ConfigPanel disabledWhen, expandedSections, description spec alignment, navigation hints#805
hotlong merged 5 commits intomainfrom
copilot/fix-view-config-panel-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Addresses several ViewConfigPanel/ConfigPanelRenderer detail issues: missing disabled state for view-type-dependent fields, no external collapse control, description not in protocol spec, and no UX hints on conditionally-visible navigation fields.

Protocol alignment

  • Add description?: string to NamedListView interface — was annotated as "UI extension", now spec-aligned

disabledWhen predicate on ConfigField

  • New disabledWhen?: (draft) => boolean on ConfigField type
  • Evaluated in ConfigFieldRenderer as effectiveDisabled for all control types (input, switch, checkbox, select, slider, color, icon-group, field-picker)
  • Grid-only fields (striped, bordered, wrapHeaders, resizable) now disabled when type !== 'grid'
// buildSwitchField now accepts optional disabledWhen
buildSwitchField('striped', t('...'), 'toggle-striped', false, true,
    (draft) => draft.type != null && draft.type !== 'grid')

expandedSections prop on ConfigPanelRenderer

  • New expandedSections?: string[] prop overrides local collapsed state for listed section keys
  • Enables external callers to programmatically open/highlight specific sections

Navigation-dependent field hints

  • helpText added to _navigationWidth and _navigationOpenNewTab fields
  • New i18n keys navigationWidthHint / openNewTabHint translated across all 11 locales
  • ConfigFieldRenderer renders helpText as a <p> element below the field control for all field types including custom

Tests

  • 27 new tests: expandedSections override (3), disabledWhen evaluation (2), grid-only predicates (16), helpText validation (2), description spec alignment (1), helpText rendering in ConfigFieldRenderer (3)
  • All 283 related tests passing
Original prompt

This section details on the original issue you should resolve

<issue_title>ViewConfigPanel 部分控件细节问题及改进建议</issue_title>
<issue_description>经对 ViewConfigPanel/ConfigPanelRenderer 代码以及控件交��/协议字段适配进行精查,发现如下问题值得追踪修复:

控件 key/属性 与协议 NamedListView 字段 ⚠️ 不严格一致:部分场景(如单测、或历史逻辑)仍出现 selection.type/multi 与 multiple 混用,建议统一 key 为 multiple。

部分 UI extension 字段未全在协议 spec 体现(如 description)。建议推进协议补全相关定义。

部分设置字段是通过 visibleWhen 实现条件可见,但 UI 文案提示及状态同步逻辑不足,例如导航模式切换下 dependent 字段状态无提示。

ConfigPanelSchema Section/Field 的 collapsed 状态仅由本地 state 控制,未能支持外部打开指定Section的自动聚焦或高亮体验。

Switch/Checkbox/Input 等基础控件依赖简化 mock 组件(如测试/故事文件中代码),实际复杂场景可用性及可访问性还需生产环境下多端深测。

部分控件显示/隐藏仅依赖 visibleWhen,但缺乏 "disabled" 受控属性,会导致一些配置项在 protocol 不支持情况下未置灰。

请相关研发、产品和前端同学评估上述问题,逐项讨论优先级并逐步推进完善。

如有新增控件细节 bug 或 UX 良性建议,请补充到本 issue 下面。</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 23, 2026 3:26pm
objectui-demo Ready Ready Preview, Comment Feb 23, 2026 3:26pm
objectui-storybook Error Error Feb 23, 2026 3:26pm

Request Review

Copilot AI and others added 3 commits February 23, 2026 14:36
…cales

Add navigationWidthHint, openNewTabHint, and their parent keys
(navigationMode, navigationWidth, openNewTab) to ar, de, es, fr, ja,
ko, pt, and ru locale files. Hint values are kept in English as they
are developer-facing. Parent keys include localized translations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…description spec alignment, helpText hints

- Add `description` field to NamedListView interface (protocol alignment)
- Add `disabledWhen` predicate to ConfigField type for conditional disabling
- Implement `disabledWhen` evaluation in ConfigFieldRenderer for all control types
- Add `expandedSections` prop to ConfigPanelRenderer for external section collapse control
- Add `helpText` to navigation-dependent fields (width/openNewTab) for UX context
- Add `disabledWhen` to grid-only fields (striped/bordered/wrapHeaders/resizable)
- Add i18n keys for navigation hint text (all 11 locales)
- Add 24 new tests covering expandedSections, disabledWhen, and helpText

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…lish locales

Replaced English placeholder strings with proper translations for:
de, fr, es, pt, ja, ko, ru, ar

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues and improvements in ViewConfigPanel feat: ConfigPanel disabledWhen, expandedSections, description spec alignment, navigation hints Feb 23, 2026
Copilot AI requested a review from hotlong February 23, 2026 14:47
@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Feb 23, 2026

@copilot 仔细审查确认是否已经完成了任务中的所有要求

…ding custom

The helpText property was defined on ConfigField type and set on
navigation-dependent fields but never actually rendered. Refactored
ConfigFieldRenderer to use break-based switch + post-render helpText
wrapper. Added 3 new tests for helpText rendering.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 23, 2026

@copilot 仔细审查确认是否已经完成了任务中的所有要求

经过仔细审查,确认 6 个问题全部已完成。在本次审查中还发现并修复了一个遗漏:helpText 虽定义在 ConfigField 类型上并设置到导航依赖字段,但 ConfigFieldRenderer 并未实际渲染它。已在 e895318 修复。

逐项确认:

  1. selection key 一致性 ✅ — 代码库中无 selection.multiNamedListView 统一使用 selection?: { type: 'none' | 'single' | 'multiple' },view-config-schema 正确使用 draft.selection?.type
  2. description 协议补全 ✅ — description?: string 已添加到 NamedListView 接口,注释已从 "UI extension" 更新为 "spec: NamedListView.description"
  3. visibleWhen UX 提示 ✅ — _navigationWidth_navigationOpenNewTab 字段已添加 helpText(11 个语言),ConfigFieldRenderer 现在渲染 helpText <p> 标签(e895318 修复)
  4. 外部控制 collapsed 状态 ✅ — ConfigPanelRenderer 新增 expandedSections?: string[] prop,覆盖本地折叠状态
  5. Mock 组件可用性 — 确认为测试基础设施问题,非代码修复项
  6. disabledWhen 受控属性 ✅ — ConfigField 新增 disabledWhen 谓词,ConfigFieldRenderer 对所有控件类型生效,grid-only 字段(striped/bordered/wrapHeaders/resizable)在非 grid 视图下置灰

283 个测试全部通过(新增 27 个测试)。

@hotlong hotlong marked this pull request as ready for review February 23, 2026 15:38
Copilot AI review requested due to automatic review settings February 23, 2026 15:38
@hotlong hotlong merged commit 29f8fc0 into main Feb 23, 2026
5 of 6 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ConfigPanel system with protocol alignment, conditional field disabling, external collapse control, and user-facing hints for navigation-dependent fields. It addresses 4 of 6 issues raised in #804, focusing on spec alignment and UX improvements.

Changes:

  • Added description field to NamedListView protocol interface for spec alignment
  • Implemented disabledWhen predicate on ConfigField to conditionally disable fields based on draft state
  • Added expandedSections prop to ConfigPanelRenderer for programmatic section expansion control
  • Refactored ConfigFieldRenderer to support helpText rendering for all field types and unified disabledWhen evaluation
  • Added contextual hints for navigation-dependent fields with translations across all 10 locales

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/objectql.ts Added optional description field to NamedListView interface for protocol spec alignment
packages/i18n/src/locales/*.ts Added navigationWidthHint and openNewTabHint translation keys across all 10 locale files
packages/components/src/types/config-panel.ts Added disabledWhen predicate to ConfigField interface for conditional field disabling
packages/components/src/custom/config-panel-renderer.tsx Added expandedSections prop for external section collapse control with proper precedence over local state
packages/components/src/custom/config-field-renderer.tsx Refactored switch cases to break pattern, implemented universal disabledWhen evaluation and helpText rendering wrapper
packages/components/src/tests/config-panel-renderer.test.tsx Added 5 new tests covering expandedSections override and disabledWhen evaluation
packages/components/src/tests/config-field-renderer.test.tsx Added 3 new tests verifying helpText rendering for standard and custom field types
apps/console/src/utils/view-config-schema.tsx Applied disabledWhen predicates to grid-only fields, added helpText to navigation fields, updated buildSwitchField signature, corrected description field comment
apps/console/src/tests/view-config-schema.test.tsx Added 19 new tests covering grid-only disabledWhen predicates, helpText validation, and description spec alignment
ROADMAP.md Updated Phase 5 documentation with new features and test counts

Comment on lines +407 to +409
navigationWidthHint: 'Available for drawer, modal, and split navigation modes',
openNewTab: 'Open in new tab',
openNewTabHint: 'Available for page and new window navigation modes',
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions "all 11 locales" but the codebase actually has 10 built-in locales (en, zh, ja, ko, de, fr, es, pt, ru, ar). All 10 locales have been correctly updated with the new translation keys navigationWidthHint and openNewTabHint.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ViewConfigPanel 部分控件细节问题及改进建议

3 participants