Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

DataView filters: support icons on select options (and use field.icon)

未关闭 适合新手
#942 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
86/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript
领域
frontend

调研方向

从 issue 中提到的类型 FilterSelectOption 和组件 FilterChip 开始,再加上展示 SelectItemProps 和 leadingIcon 的 Select.Item 实现。追踪过滤选项在何处被 spread,以及 "Add filter" 菜单项在何处被构建,以了解为什么 DataViewField.icon 从未被读取。完成标准是:选项带有 leadingIcon/disabled,单值 chip 显示该图标,field.icon 出现在菜单和 chip 中,并且 DataView/FilterChip 现有的组件测试仍然通过。

由索引模型根据 Issue 内容生成。

描述

Select filters in DataView can only show plain text options right now. A lot of filters can have an icon that goes with each value, like a status dot, a priority glyph, or an avatar. Without it, the filter dropdown looks different from the column it's filtering, and it's slower to scan.

Select.Item already supports leadingIcon. But FilterSelectOption is just { value, label }, and FilterChip only passes label through, so there's no way to get an icon in.

Also, DataViewField has an icon prop, but as far as I can tell nothing reads it. It doesn't show in the "Add filter" menu or on the chip.

What I'd suggest

  1. Let filter options take the same extras Select.Item does, instead of adding fields one by one:

    type FilterSelectOption = {
      value: FilterValueType;
      label: string;
    } & Pick<SelectItemProps, 'leadingIcon' | 'disabled'>;
    

    FilterChip would spread those onto Select.Item. label stays a plain string, since search, accessibility and the "N selected" text all depend on it.

  2. When one value is picked, show its icon in the chip as well, not just in the dropdown. Multiple values can keep showing "N selected".

  3. Use field.icon for the "Add filter" menu item and the chip's leadingIcon.

I'd skip a render-prop like renderOption. It would break the text-based stuff above, and every app would end up drawing options differently. If two-line options are ever needed (name + email), a description field would cover that better.

主要语言
TypeScript
星标
68
派生
13
平均合并
4 天 19 小时
30 天内合并 PR
37

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

raystack/apsara 的其他 Issue

查看 raystack/apsara 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。