@angular/cdk 13.0.0 → 13.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -612,6 +612,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ng
612
612
  class CdkNoDataRow {
613
613
  constructor(templateRef) {
614
614
  this.templateRef = templateRef;
615
+ this._contentClassName = 'cdk-no-data-row';
615
616
  }
616
617
  }
617
618
  CdkNoDataRow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: CdkNoDataRow, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
@@ -1949,14 +1950,28 @@ class CdkTable {
1949
1950
  /** Creates or removes the no data row, depending on whether any data is being shown. */
1950
1951
  _updateNoDataRow() {
1951
1952
  const noDataRow = this._customNoDataRow || this._noDataRow;
1952
- if (noDataRow) {
1953
- const shouldShow = this._rowOutlet.viewContainer.length === 0;
1954
- if (shouldShow !== this._isShowingNoDataRow) {
1955
- const container = this._noDataRowOutlet.viewContainer;
1956
- shouldShow ? container.createEmbeddedView(noDataRow.templateRef) : container.clear();
1957
- this._isShowingNoDataRow = shouldShow;
1953
+ if (!noDataRow) {
1954
+ return;
1955
+ }
1956
+ const shouldShow = this._rowOutlet.viewContainer.length === 0;
1957
+ if (shouldShow === this._isShowingNoDataRow) {
1958
+ return;
1959
+ }
1960
+ const container = this._noDataRowOutlet.viewContainer;
1961
+ if (shouldShow) {
1962
+ const view = container.createEmbeddedView(noDataRow.templateRef);
1963
+ const rootNode = view.rootNodes[0];
1964
+ // Only add the attributes if we have a single root node since it's hard
1965
+ // to figure out which one to add it to when there are multiple.
1966
+ if (view.rootNodes.length === 1 && rootNode?.nodeType === this._document.ELEMENT_NODE) {
1967
+ rootNode.setAttribute('role', 'row');
1968
+ rootNode.classList.add(noDataRow._contentClassName);
1958
1969
  }
1959
1970
  }
1971
+ else {
1972
+ container.clear();
1973
+ }
1974
+ this._isShowingNoDataRow = shouldShow;
1960
1975
  }
1961
1976
  }
1962
1977
  CdkTable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.3", ngImport: i0, type: CdkTable, deps: [{ token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: 'role', attribute: true }, { token: i1.Directionality, optional: true }, { token: DOCUMENT }, { token: i2.Platform }, { token: _VIEW_REPEATER_STRATEGY }, { token: _COALESCED_STYLE_SCHEDULER }, { token: i3.ViewportRuler }, { token: STICKY_POSITIONING_LISTENER, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });