@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.
@@ -622,6 +622,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.3", ng
622
622
  class CdkNoDataRow {
623
623
  constructor(templateRef) {
624
624
  this.templateRef = templateRef;
625
+ this._contentClassName = 'cdk-no-data-row';
625
626
  }
626
627
  }
627
628
  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 });
@@ -1953,14 +1954,28 @@ class CdkTable {
1953
1954
  /** Creates or removes the no data row, depending on whether any data is being shown. */
1954
1955
  _updateNoDataRow() {
1955
1956
  const noDataRow = this._customNoDataRow || this._noDataRow;
1956
- if (noDataRow) {
1957
- const shouldShow = this._rowOutlet.viewContainer.length === 0;
1958
- if (shouldShow !== this._isShowingNoDataRow) {
1959
- const container = this._noDataRowOutlet.viewContainer;
1960
- shouldShow ? container.createEmbeddedView(noDataRow.templateRef) : container.clear();
1961
- this._isShowingNoDataRow = shouldShow;
1957
+ if (!noDataRow) {
1958
+ return;
1959
+ }
1960
+ const shouldShow = this._rowOutlet.viewContainer.length === 0;
1961
+ if (shouldShow === this._isShowingNoDataRow) {
1962
+ return;
1963
+ }
1964
+ const container = this._noDataRowOutlet.viewContainer;
1965
+ if (shouldShow) {
1966
+ const view = container.createEmbeddedView(noDataRow.templateRef);
1967
+ const rootNode = view.rootNodes[0];
1968
+ // Only add the attributes if we have a single root node since it's hard
1969
+ // to figure out which one to add it to when there are multiple.
1970
+ if (view.rootNodes.length === 1 && (rootNode === null || rootNode === void 0 ? void 0 : rootNode.nodeType) === this._document.ELEMENT_NODE) {
1971
+ rootNode.setAttribute('role', 'row');
1972
+ rootNode.classList.add(noDataRow._contentClassName);
1962
1973
  }
1963
1974
  }
1975
+ else {
1976
+ container.clear();
1977
+ }
1978
+ this._isShowingNoDataRow = shouldShow;
1964
1979
  }
1965
1980
  }
1966
1981
  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 });