Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cascader] Add filterSorter , user can define sort order of filter result #1350

Closed
pointhalo opened this issue Dec 27, 2022 · 1 comment
Closed
Labels
feature request Request new feature

Comments

@pointhalo
Copy link
Collaborator

Which Component Need Enhancement 期望新增功能的组件

  • Cascader

What does the proposed API look like 期望支持的API

  • Add API:filterSorter

Feature Description 功能描述

很多待搜索项都具有【douyin】字段。但是大多数用户都想搜索出【douyin】这一项,而不是别的。
但是目前的组件会导致【douyin】这一项会出现在搜索结果列表的很底部,不方便用户使用
希望增加 sorter API允许用户对筛选结果进行再排序

image

import React, { useState } from 'react';
import { Cascader, Typography } from '@douyinfe/semi-ui';
() => {
    const treeData = [
        {
            label: '浙江省',
            value: 'zhejiang',
            children: [
                {
                    label: '杭州市',
                    value: 'hangzhou',
                    children: [
                        {
                            label: 'douyin_aaa',
                            value: 'douyin_aaa',
                        },
                        {
                            label: 'douyin_bbbb',
                            value: 'douyin_bbbb',
                        },
                        {
                            label: 'douyin_cccc',
                            value: 'douyin_cccc',
                        },
                        {
                            label: 'douyin_ffff',
                            value: 'douyin_ffff',
                        },
                        {
                            label: 'douyin_gggg',
                            value: 'douyin_gggg',
                        },
                        {
                            label: 'douyin_eeee',
                            value: 'douyin_eeee',
                        },
                    ],
                },
                {
                    label: '宁波市',
                    value: 'ningbo',
                    children: [
                        {
                            label: 'douyin',
                            value: 'douyin',
                        },
                        {
                            label: 'douyin_ddddd',
                            value: 'douyin_ddddd',
                        },
                    ]
                },
            ],
        }
    ];
    return (
        <div>
            <Cascader
                style={{ width: 300 }}
                treeData={treeData}
                placeholder="默认对label值进行搜索"
                filterTreeNode
            />
        </div>
    );
};

Additional information 补充说明

@pointhalo pointhalo added the feature request Request new feature label Dec 27, 2022
pointhalo pushed a commit that referenced this issue Jan 13, 2023
… third params, close #1355, #1350, #1104

* feat: [Cascader] Newly added filterSorter, filterRender API, filterTreeNode function added data parameters

* chore: fix test:coverage error

* chore: fix test:coverage error

* fix: Fix the option that cannot be selected after searching in Cascader multi-selection state

* docs: optimize API description
@YyumeiZhang
Copy link
Collaborator

YyumeiZhang commented Jan 17, 2023

v2.28.0-beta.1 已发版

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request new feature
Projects
None yet
Development

No branches or pull requests

2 participants