angular / angular/components

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

オープン
#10,185 コメント 7 件 リアクション 5 件 担当者 0 名 GitHub で見る
area: material/select feature P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず Angular Material の mat-select と matInput のエントリーポイントを読み、次に、それらに関連付けられた FormControls が現在どのように値を公開しているかを確認します。オプションの "other" 選択肢とカスタムテキストが mat-select および FormControl とどのように連携すべきかを定義し、実装前に定義済みの選択肢とカスタム選択肢のテストを用意します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。