angular / angular/components

feat(CdkMenu/CdkContextMenuTriggerFor): Allow CdkMenu to be programmatically opened/closed

未关闭
#29,072 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/menu feature P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

## Feature Description

### Current Behaviour

The directive `CdkMenu` is used with combination of `CdkContextMenuTriggerFor`. When user right-clicks (context-menu event), the menu gets opened and clicking on outside of the menu will close the menu.

### New Feature Requested

It would be great if user can manually/programmatically open/close the menu. And also disable closing the menu clicking outside.

#### Possible Solutions

1. Add a boolean input property `cdkContextMenuDisableCloseOnOutsideClick` - This will disable closing the `CdkMenu` on outside click
2. Add an event emitter property `cdkContextMenuTriggered` - This will emit everytime user right-clicks (context-menu event) with the coordinates
3. Add an event emitter property `cdkContextMenuClickedOutside` - This will emit everytime user clicks outside of the `CdkMenu`

### Use Case

This will allow users to handle animations with `CdkMenu` if they want to apply on open/close.

贡献指南

打开贡献指南

调研方向

首先阅读 CdkMenu 和 CdkContextMenuTriggerFor 指令入口点,并追踪现有的上下文菜单打开行为和外部点击关闭行为。明确以编程方式打开/关闭、禁用外部点击关闭,以及上下文菜单/外部点击通知的公共 API 和事件语义。实现约定的行为,并由相关菜单测试覆盖,即视为完成。

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

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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