@@ -22,12 +22,12 @@ import {
2222 booleanAttribute ,
2323 numberAttribute ,
2424} from '@angular/core' ;
25- import { MatFormField , MatFormFieldAppearance } from '@angular/material/form-field' ;
26- import { HasInitialized , MatOption , mixinInitialized , ThemePalette } from '@angular/material/core' ;
25+ import { MatOption , ThemePalette } from '@angular/material/core' ;
2726import { MatSelect } from '@angular/material/select' ;
2827import { MatIconButton } from '@angular/material/button' ;
2928import { MatTooltip } from '@angular/material/tooltip' ;
30- import { Subscription } from 'rxjs' ;
29+ import { MatFormField , MatFormFieldAppearance } from '@angular/material/form-field' ;
30+ import { Observable , ReplaySubject , Subscription } from 'rxjs' ;
3131import { MatPaginatorIntl } from './paginator-intl' ;
3232
3333/** The default page size if there is no page size and there are no provided page size options. */
@@ -90,10 +90,6 @@ export const MAT_PAGINATOR_DEFAULT_OPTIONS = new InjectionToken<MatPaginatorDefa
9090 'MAT_PAGINATOR_DEFAULT_OPTIONS' ,
9191) ;
9292
93- // Boilerplate for applying mixins to _MatPaginatorBase.
94- /** @docs -private */
95- const _MatPaginatorMixinBase = mixinInitialized ( class { } ) ;
96-
9793let nextUniqueId = 0 ;
9894
9995/**
@@ -115,18 +111,16 @@ let nextUniqueId = 0;
115111 standalone : true ,
116112 imports : [ MatFormField , MatSelect , MatOption , MatIconButton , MatTooltip ] ,
117113} )
118- export class MatPaginator
119- extends _MatPaginatorMixinBase
120- implements OnInit , OnDestroy , HasInitialized
121- {
114+ export class MatPaginator implements OnInit , OnDestroy {
122115 /** If set, styles the "page size" form field with the designated style. */
123116 _formFieldAppearance ?: MatFormFieldAppearance ;
124117
125118 /** ID for the DOM node containing the paginator's items per page label. */
126119 readonly _pageSizeLabelId = `mat-paginator-page-size-label-${ nextUniqueId ++ } ` ;
127120
128- private _initialized : boolean ;
129121 private _intlChanges : Subscription ;
122+ private _isInitialized = false ;
123+ private _initializedStream = new ReplaySubject < void > ( 1 ) ;
130124
131125 /** Theme color to be used for the underlying form controls. */
132126 @Input ( ) color : ThemePalette ;
@@ -196,12 +190,14 @@ export class MatPaginator
196190 /** Displayed set of page size options. Will be sorted and include current page size. */
197191 _displayedPageSizeOptions : number [ ] ;
198192
193+ /** Emits when the paginator is initialized. */
194+ initialized : Observable < void > = this . _initializedStream ;
195+
199196 constructor (
200197 public _intl : MatPaginatorIntl ,
201198 private _changeDetectorRef : ChangeDetectorRef ,
202199 @Optional ( ) @Inject ( MAT_PAGINATOR_DEFAULT_OPTIONS ) defaults ?: MatPaginatorDefaultOptions ,
203200 ) {
204- super ( ) ;
205201 this . _intlChanges = _intl . changes . subscribe ( ( ) => this . _changeDetectorRef . markForCheck ( ) ) ;
206202
207203 if ( defaults ) {
@@ -228,12 +224,13 @@ export class MatPaginator
228224 }
229225
230226 ngOnInit ( ) {
231- this . _initialized = true ;
227+ this . _isInitialized = true ;
232228 this . _updateDisplayedPageSizeOptions ( ) ;
233- this . _markInitialized ( ) ;
229+ this . _initializedStream . next ( ) ;
234230 }
235231
236232 ngOnDestroy ( ) {
233+ this . _initializedStream . complete ( ) ;
237234 this . _intlChanges . unsubscribe ( ) ;
238235 }
239236
@@ -337,7 +334,7 @@ export class MatPaginator
337334 * the page size is an option and that the list is sorted.
338335 */
339336 private _updateDisplayedPageSizeOptions ( ) {
340- if ( ! this . _initialized ) {
337+ if ( ! this . _isInitialized ) {
341338 return ;
342339 }
343340
0 commit comments