@@ -11,6 +11,11 @@ export type ParamDeserializer<T> = (value: string | null) => T | null;
1111/** TODO Documentation */
1212export type OnChangeFunction < T > = ( value : T ) => void ;
1313
14+ /** TODO Documentation */
15+ export interface QueryParamGroupValue {
16+ [ controlName : string ] : any ;
17+ }
18+
1419/**
1520 * TODO Documentation
1621 */
@@ -34,10 +39,10 @@ export interface QueryParamControlOpts<T> {
3439 */
3540export class QueryParamGroup {
3641
37- private _valueChanges = new Subject < any > ( ) ;
42+ private _valueChanges = new Subject < QueryParamGroupValue > ( ) ;
3843
3944 /** TODO Documentation */
40- public readonly valueChanges : Observable < any > = this . _valueChanges . asObservable ( ) ;
45+ public readonly valueChanges : Observable < QueryParamGroupValue > = this . _valueChanges . asObservable ( ) ;
4146
4247 /** TODO Documentation */
4348 public readonly controls : { [ controlName : string ] : QueryParamControl < any > } ;
@@ -53,13 +58,34 @@ export class QueryParamGroup {
5358 }
5459
5560 /** TODO Documentation */
56- public get value ( ) : any {
57- const value : any = { } ;
61+ public get value ( ) : QueryParamGroupValue {
62+ const value : QueryParamGroupValue = { } ;
5863 Object . keys ( this . controls ) . forEach ( controlName => value [ controlName ] = this . controls [ controlName ] . value ) ;
5964
6065 return value ;
6166 }
6267
68+ /**
69+ * TODO Documentation
70+ */
71+ public patchValue ( value : QueryParamGroupValue ) : void {
72+ Object . keys ( value ) . forEach ( controlName => {
73+ const control = this . controls [ controlName ] ;
74+ if ( isMissing ( control ) ) {
75+ return ;
76+ }
77+
78+ control . setValue ( value [ controlName ] ) ;
79+ } ) ;
80+ }
81+
82+ /**
83+ * TODO Documentation
84+ */
85+ public setValue ( value : QueryParamGroupValue ) : void {
86+ Object . keys ( this . controls ) . forEach ( controlName => this . controls [ controlName ] . setValue ( value [ controlName ] ) ) ;
87+ }
88+
6389 /**
6490 * TODO Documentation
6591 */
0 commit comments