angular / angular/components

feat(mat-select): add "select other" optional functionality

Đang mở
#10,185 7 bình luận 5 reaction 0 người được giao Xem trên GitHub
area: material/select feature P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

#### Bug, feature request, or proposal:
Feature request

#### What is the expected behavior?
Add "select other" / "select custom" *optional* functionality to `mat-select`. This would provide a seamless way for a dev to let a user select from a predefined list of drop down items _**or**_ to provide a custom selection. I imagine if someone chose the "other" option of a `mat-select` dropdown, a `matInput` text field would appear and accept input. Crucially, user updates to this "other" `matInput` field would change the value of the `FormControl` associated with the `mat-select` field.

#### What is the current behavior?

Currently, this functionality can already be achieved however it is not easy. In my app I have made a custom "select-other" form control by combining a `mat-select` and `matInput` controls, both of which have their own `FormControl`. The component needs to flatten output from both of these controls so that I can interact with the component by just giving it one `FormControl` as input. It works, but it's not super clean. I'm assuming that a "select other" option (similar to a Google Form's "other" radio button option) is a pretty common design need.

#### What is the use-case or motivation for changing an existing behavior?
Increase developer happiness.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
5.x

#### Is there anything else we should know?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc các entry point Angular Material mat-select và matInput, sau đó xem xét cách các FormControls liên kết với chúng hiện đang cung cấp các giá trị. Xác định cách một lựa chọn "other" tùy chọn và văn bản tùy chỉnh sẽ tương tác với mat-select và FormControl, đồng thời thiết lập các bài kiểm thử cho các lựa chọn được định nghĩa trước và lựa chọn tùy chỉnh trước khi triển khai.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.