MCPcopy Create free account
hub / github.com/angular/components / _cacheRowDefs

Method _cacheRowDefs

src/cdk/table/table.ts:1150–1180  ·  view source on GitHub ↗

Update the list of all available row definitions that can be used.

()

Source from the content-addressed store, hash-verified

1148
1149 /** Update the list of all available row definitions that can be used. */
1150 private _cacheRowDefs() {
1151 this._headerRowDefs = mergeArrayAndSet(
1152 this._getOwnDefs(this._contentHeaderRowDefs),
1153 this._customHeaderRowDefs,
1154 );
1155 this._footerRowDefs = mergeArrayAndSet(
1156 this._getOwnDefs(this._contentFooterRowDefs),
1157 this._customFooterRowDefs,
1158 );
1159 this._rowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentRowDefs), this._customRowDefs);
1160
1161 // After all row definitions are determined, find the row definition to be considered default.
1162 const defaultRowDefs = this._rowDefs.filter(def => !def.when);
1163
1164 if (typeof ngDevMode === 'undefined' || ngDevMode) {
1165 // At the moment of writing, it's tricky to support `when` with virtual scrolling
1166 // because we reuse templates and they can change arbitrarily based on the `when`
1167 // condition. We may be able to support it in the future (see #32670).
1168 if (this._virtualScrollEnabled() && this._rowDefs.some(def => def.when)) {
1169 throw new Error(
1170 'Conditional row definitions via the `when` input are not ' +
1171 'supported when virtual scrolling is enabled, at the moment.',
1172 );
1173 }
1174
1175 if (!this.multiTemplateDataRows && defaultRowDefs.length > 1) {
1176 throw getTableMultipleDefaultRowDefsError();
1177 }
1178 }
1179 this._defaultRowDef = defaultRowDefs[0];
1180 }
1181
1182 /**
1183 * Check if the header, data, or footer rows have changed what columns they want to display or

Callers 1

_renderMethod · 0.95

Calls 5

_getOwnDefsMethod · 0.95
_virtualScrollEnabledMethod · 0.95
mergeArrayAndSetFunction · 0.85
filterMethod · 0.45

Tested by

no test coverage detected