angular / angular/components

feat(MatDIalog): Allow specifying MatDialogConfig as part of the dialog component

Abierto
#25,582 3 comentarios 1 reacción 0 asignados Ver en GitHub
area: material/dialog feature P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### Feature Description

Currently if there is a dialog which is meant to be used with a specific width, height, autoFocus, disableClose, etc... each and every code that opens that dialog need to specify those values. Even if extracted to a const you still need to remember to pass it.

What I wish to have is the ability to specify on the dialog component itself those configuration options or at least some of them that make sense. Allowing to actually "declare" to the one using - If you pass nothing in the `open` function config - this is the recommended and default config for this specific dialog. If you do pass a config object it overrides the recommended one.

### Use Case

When having a dialog that needs for example to have `autoFocus` as false always as it handles it inside - everyone using that dialog has to remember to declare this specific config when opening otherwise the dialog won't work as expected. Even if it was extracted to a const - the one opening the dialog still needs to know that const exists and remember to pass it.
The suggestion allows the dialog creator to specify the default config.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza revisando las API de MatDialog y MatDialogConfig y la discusión existente del issue. Define cómo declararía un componente de diálogo la configuración predeterminada y cómo los valores proporcionados a open la sobrescribirían; se considera terminado cuando el comportamiento solicitado de default-config esté especificado y cubierto por las pruebas adecuadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.