Skip to content

✨ [Feature]: 建议对d-casader组件增加回调函数控制是否可选 #338

@guanghe1990

Description

@guanghe1990

What problem does this feature solve

使用d-cascader组件时,有时虽然是叶子节点(isLeaf:true),但是业务逻辑上需要禁止选择。建议组件增加一个回调函数,返回true则选择成功,返回false则选择失败。或者直接在CascaderItem类型上面增加一个属性canSelectable:boolean;用来控制是否可以选择。

What does the proposed API look like

如果增加回调函数:
<d-cascader
[options]="options"
[(ngModel)]="value"
[canSelectable]=canSelect

canSelect(value:number|string):boolean;

或者在CascaderItem类型增加canSelectable:boolean属性:
interface CascaderItem {
label: string;
value: number | string;
isLeaf?: boolean;
children?: CascaderItem[];
canSelectable:boolean
disabled?: boolean;
icon?: string;
// 用户可以传入自定义属性,并在dropDownItemTemplate中使用
[prop: string]: any;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions