@angular/cdk 11.1.1 → 11.1.2

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.
@@ -27,7 +27,7 @@
27
27
  * Use of this source code is governed by an MIT-style license that can be
28
28
  * found in the LICENSE file at https://angular.io/license
29
29
  */
30
- var V,M,U,W,q=["top","bottom","left","right"],z=function(){function e(e,t,o,r,n,i,s){void 0===n&&(n=!0),void 0===i&&(i=!0),this._isNativeHtmlTable=e,this._stickCellCss=t,this.direction=o,this._coalescedStyleScheduler=r,this._isBrowser=n,this._needsPositionStickyOnElement=i,this._positionListener=s,this._cachedCellWidths=[],this._borderCellCss={top:t+"-border-elem-top",bottom:t+"-border-elem-bottom",left:t+"-border-elem-left",right:t+"-border-elem-right"}}return e.prototype.clearStickyPositioning=function(e,t){var o,r,n=this,i=[];try{for(var s=h(e),a=s.next();!a.done;a=s.next()){var c=a.value;if(c.nodeType===c.ELEMENT_NODE){i.push(c);for(var l=0;l<c.children.length;l++)i.push(c.children[l])}}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}this._scheduleStyleChanges((function(){var e,o;try{for(var r=h(i),s=r.next();!s.done;s=r.next())n._removeStickyStyle(s.value,t)}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=r.return)&&o.call(r)}finally{if(e)throw e.error}}}))},e.prototype.updateStickyColumns=function(e,t,o,r){var n=this;if(void 0===r&&(r=!0),e.length&&this._isBrowser&&(t.some((function(e){return e}))||o.some((function(e){return e})))){var i=e[0],s=i.children.length,a=this._getCellWidths(i,r),c=this._getStickyStartColumnPositions(a,t),l=this._getStickyEndColumnPositions(a,o),u=t.lastIndexOf(!0),d=o.indexOf(!0);this._scheduleStyleChanges((function(){var r,i,f="rtl"===n.direction,p=f?"right":"left",y=f?"left":"right";try{for(var _=h(e),m=_.next();!m.done;m=_.next())for(var w=m.value,g=0;g<s;g++){var C=w.children[g];t[g]&&n._addStickyStyle(C,p,c[g],g===u),o[g]&&n._addStickyStyle(C,y,l[g],g===d)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=_.return)&&i.call(_)}finally{if(r)throw r.error}}n._positionListener&&(n._positionListener.stickyColumnsUpdated({sizes:-1===u?[]:a.slice(0,u+1).map((function(e,o){return t[o]?e:null}))}),n._positionListener.stickyEndColumnsUpdated({sizes:-1===d?[]:a.slice(d).map((function(e,t){return o[t+d]?e:null})).reverse()}))}))}else this._positionListener&&(this._positionListener.stickyColumnsUpdated({sizes:[]}),this._positionListener.stickyEndColumnsUpdated({sizes:[]}))},e.prototype.stickRows=function(e,t,o){var r=this;if(this._isBrowser){for(var n="bottom"===o?e.slice().reverse():e,i="bottom"===o?t.slice().reverse():t,s=[],a=[],c=[],l=0,u=0;l<n.length;l++)if(s[l]=u,i[l]){var d=n[l];c[l]=this._isNativeHtmlTable?Array.from(d.children):[d];var f=d.getBoundingClientRect().height;u+=f,a[l]=f}var p=i.lastIndexOf(!0);this._scheduleStyleChanges((function(){for(var e,t,l,u,d=0;d<n.length;d++)if(i[d]){var f=s[d],y=d===p;try{for(var _=(e=void 0,h(c[d])),m=_.next();!m.done;m=_.next())r._addStickyStyle(m.value,o,f,y)}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=_.return)&&t.call(_)}finally{if(e)throw e.error}}}"top"===o?null===(l=r._positionListener)||void 0===l||l.stickyHeaderRowsUpdated({sizes:a}):null===(u=r._positionListener)||void 0===u||u.stickyFooterRowsUpdated({sizes:a})}))}},e.prototype.updateStickyFooterContainer=function(e,t){var o=this;if(this._isNativeHtmlTable){var r=e.querySelector("tfoot");this._scheduleStyleChanges((function(){t.some((function(e){return!e}))?o._removeStickyStyle(r,["bottom"]):o._addStickyStyle(r,"bottom",0,!1)}))}},e.prototype._removeStickyStyle=function(e,t){var o,r;try{for(var n=h(t),i=n.next();!i.done;i=n.next()){var s=i.value;e.style[s]="",e.classList.remove(this._borderCellCss[s])}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}q.some((function(o){return-1===t.indexOf(o)&&e.style[o]}))?e.style.zIndex=this._getCalculatedZIndex(e):(e.style.zIndex="",this._needsPositionStickyOnElement&&(e.style.position=""),e.classList.remove(this._stickCellCss))},e.prototype._addStickyStyle=function(e,t,o,r){e.classList.add(this._stickCellCss),r&&e.classList.add(this._borderCellCss[t]),e.style[t]=o+"px",e.style.zIndex=this._getCalculatedZIndex(e),this._needsPositionStickyOnElement&&(e.style.cssText+="position: -webkit-sticky; position: sticky; ")},e.prototype._getCalculatedZIndex=function(e){var t,o,r={top:100,bottom:10,left:1,right:1},n=0;try{for(var i=h(q),s=i.next();!s.done;s=i.next()){var a=s.value;e.style[a]&&(n+=r[a])}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}return n?""+n:""},e.prototype._getCellWidths=function(e,t){if(void 0===t&&(t=!0),!t&&this._cachedCellWidths.length)return this._cachedCellWidths;for(var o=[],r=e.children,n=0;n<r.length;n++)o.push(r[n].getBoundingClientRect().width);return this._cachedCellWidths=o,o},e.prototype._getStickyStartColumnPositions=function(e,t){for(var o=[],r=0,n=0;n<e.length;n++)t[n]&&(o[n]=r,r+=e[n]);return o},e.prototype._getStickyEndColumnPositions=function(e,t){for(var o=[],r=0,n=e.length;n>0;n--)t[n]&&(o[n]=r,r+=e[n]);return o},e.prototype._scheduleStyleChanges=function(e){this._coalescedStyleScheduler?this._coalescedStyleScheduler.schedule(e):e()},e}(),K=new a.InjectionToken("CDK_SPL");(V=function V(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[rowOutlet]"}]}],V.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(M=function M(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[headerRowOutlet]"}]}],M.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(U=function U(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[footerRowOutlet]"}]}],U.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(W=function W(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[noDataRowOutlet]"}]}],W.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]};var Z,Y='\n <ng-content select="caption"></ng-content>\n <ng-content select="colgroup, col"></ng-content>\n <ng-container headerRowOutlet></ng-container>\n <ng-container rowOutlet></ng-container>\n <ng-container noDataRowOutlet></ng-container>\n <ng-container footerRowOutlet></ng-container>\n',G=(d((function $(){return null!==Z&&Z.apply(this,arguments)||this}),Z=a.EmbeddedViewRef),function(){function e(e,t,o,r,n,i,s,a,l,u,d){this._differs=e,this._changeDetectorRef=t,this._elementRef=o,this._dir=n,this._platform=s,this._viewRepeater=a,this._coalescedStyleScheduler=l,this._stickyPositioningListener=u,this._viewportRuler=d,this._onDestroy=new c.Subject,this._columnDefsByName=new Map,this._customColumnDefs=new Set,this._customRowDefs=new Set,this._customHeaderRowDefs=new Set,this._customFooterRowDefs=new Set,this._headerRowDefChanged=!0,this._footerRowDefChanged=!0,this._stickyColumnStylesNeedReset=!0,this._forceRecalculateCellWidths=!0,this._cachedRenderRowsMap=new Map,this.stickyCssClass="cdk-table-sticky",this.needsPositionStickyOnElement=!0,this._isShowingNoDataRow=!1,this._multiTemplateDataRows=!1,this._fixedLayout=!1,this.viewChange=new c.BehaviorSubject({start:0,end:Number.MAX_VALUE}),r||this._elementRef.nativeElement.setAttribute("role","grid"),this._document=i,this._isNativeHtmlTable="TABLE"===this._elementRef.nativeElement.nodeName}return Object.defineProperty(e.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(e){this._trackByFn=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource!==e&&this._switchDataSource(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multiTemplateDataRows",{get:function(){return this._multiTemplateDataRows},set:function(e){this._multiTemplateDataRows=o.coerceBooleanProperty(e),this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fixedLayout",{get:function(){return this._fixedLayout},set:function(e){this._fixedLayout=o.coerceBooleanProperty(e),this._forceRecalculateCellWidths=!0,this._stickyColumnStylesNeedReset=!0},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this._setupStickyStyler(),this._isNativeHtmlTable&&this._applyNativeTableSections(),this._dataDiffer=this._differs.find([]).create((function(t,o){return e.trackBy?e.trackBy(o.dataIndex,o.data):o})),this._viewportRuler&&this._viewportRuler.change().pipe(l.takeUntil(this._onDestroy)).subscribe((function(){e._forceRecalculateCellWidths=!0}))},e.prototype.ngAfterContentChecked=function(){this._cacheRowDefs(),this._cacheColumnDefs();var e=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||e,this._forceRecalculateCellWidths=e,this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=!1),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=!1),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription?this._observeRenderChanges():this._stickyColumnStylesNeedReset&&this.updateStickyColumnStyles(),this._checkStickyStates()},e.prototype.ngOnDestroy=function(){this._rowOutlet.viewContainer.clear(),this._noDataRowOutlet.viewContainer.clear(),this._headerRowOutlet.viewContainer.clear(),this._footerRowOutlet.viewContainer.clear(),this._cachedRenderRowsMap.clear(),this._onDestroy.next(),this._onDestroy.complete(),r.isDataSource(this.dataSource)&&this.dataSource.disconnect(this)},e.prototype.renderRows=function(){var e=this;this._renderRows=this._getAllRenderRows();var t=this._dataDiffer.diff(this._renderRows);if(t){var o=this._rowOutlet.viewContainer;this._viewRepeater?this._viewRepeater.applyChanges(t,o,(function(t,o,r){return e._getEmbeddedViewArgs(t.item,r)}),(function(e){return e.item.data}),(function(t){1===t.operation&&t.context&&e._renderCellTemplateForItem(t.record.item.rowDef,t.context)})):t.forEachOperation((function(t,r,n){if(null==t.previousIndex){var i=t.item;e._renderRow(e._rowOutlet,i.rowDef,n,{$implicit:i.data})}else if(null==n)o.remove(r);else{var s=o.get(r);o.move(s,n)}})),this._updateRowIndexContext(),t.forEachIdentityChange((function(e){o.get(e.currentIndex).context.$implicit=e.item.data})),this._updateNoDataRow(),this.updateStickyColumnStyles()}else this._updateNoDataRow()},e.prototype.addColumnDef=function(e){this._customColumnDefs.add(e)},e.prototype.removeColumnDef=function(e){this._customColumnDefs.delete(e)},e.prototype.addRowDef=function(e){this._customRowDefs.add(e)},e.prototype.removeRowDef=function(e){this._customRowDefs.delete(e)},e.prototype.addHeaderRowDef=function(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=!0},e.prototype.removeHeaderRowDef=function(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=!0},e.prototype.addFooterRowDef=function(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=!0},e.prototype.removeFooterRowDef=function(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=!0},e.prototype.setNoDataRow=function(e){this._customNoDataRow=e},e.prototype.updateStickyHeaderRowStyles=function(){var e=this._getRenderedRows(this._headerRowOutlet),t=this._elementRef.nativeElement.querySelector("thead");t&&(t.style.display=e.length?"":"none");var o=this._headerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,o,"top"),this._headerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyFooterRowStyles=function(){var e=this._getRenderedRows(this._footerRowOutlet),t=this._elementRef.nativeElement.querySelector("tfoot");t&&(t.style.display=e.length?"":"none");var o=this._footerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,o,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,o),this._footerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyColumnStyles=function(){var e=this,t=this._getRenderedRows(this._headerRowOutlet),o=this._getRenderedRows(this._rowOutlet),r=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this._fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning(p(t,o,r),["left","right"]),this._stickyColumnStylesNeedReset=!1),t.forEach((function(t,o){e._addStickyColumnStyles([t],e._headerRowDefs[o])})),this._rowDefs.forEach((function(t){for(var r=[],n=0;n<o.length;n++)e._renderRows[n].rowDef===t&&r.push(o[n]);e._addStickyColumnStyles(r,t)})),r.forEach((function(t,o){e._addStickyColumnStyles([t],e._footerRowDefs[o])})),Array.from(this._columnDefsByName.values()).forEach((function(e){return e.resetStickyChanged()}))},e.prototype._getAllRenderRows=function(){var e=[],t=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(var o=0;o<this._data.length;o++){var r=this._data[o],n=this._getRenderRowsForData(r,o,t.get(r));this._cachedRenderRowsMap.has(r)||this._cachedRenderRowsMap.set(r,new WeakMap);for(var i=0;i<n.length;i++){var s=n[i],a=this._cachedRenderRowsMap.get(s.data);a.has(s.rowDef)?a.get(s.rowDef).push(s):a.set(s.rowDef,[s]),e.push(s)}}return e},e.prototype._getRenderRowsForData=function(e,t,o){return this._getRowDefs(e,t).map((function(r){var n=o&&o.has(r)?o.get(r):[];if(n.length){var i=n.shift();return i.dataIndex=t,i}return{data:e,rowDef:r,dataIndex:t}}))},e.prototype._cacheColumnDefs=function(){var e=this;this._columnDefsByName.clear(),X(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach((function(t){e._columnDefsByName.has(t.name),e._columnDefsByName.set(t.name,t)}))},e.prototype._cacheRowDefs=function(){this._headerRowDefs=X(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=X(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=X(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);var e=this._rowDefs.filter((function(e){return!e.when}));this._defaultRowDef=e[0]},e.prototype._renderUpdatedColumns=function(){var e=function(e,t){return e||!!t.getColumnsDiff()},t=this._rowDefs.reduce(e,!1);t&&this._forceRenderDataRows();var o=this._headerRowDefs.reduce(e,!1);o&&this._forceRenderHeaderRows();var r=this._footerRowDefs.reduce(e,!1);return r&&this._forceRenderFooterRows(),t||o||r},e.prototype._switchDataSource=function(e){this._data=[],r.isDataSource(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear()),this._dataSource=e},e.prototype._observeRenderChanges=function(){var e,t=this;this.dataSource&&(r.isDataSource(this.dataSource)?e=this.dataSource.connect(this):c.isObservable(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=c.of(this.dataSource)),this._renderChangeSubscription=e.pipe(l.takeUntil(this._onDestroy)).subscribe((function(e){t._data=e||[],t.renderRows()})))},e.prototype._forceRenderHeaderRows=function(){var e=this;this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((function(t,o){return e._renderRow(e._headerRowOutlet,t,o)})),this.updateStickyHeaderRowStyles()},e.prototype._forceRenderFooterRows=function(){var e=this;this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((function(t,o){return e._renderRow(e._footerRowOutlet,t,o)})),this.updateStickyFooterRowStyles()},e.prototype._addStickyColumnStyles=function(e,t){var o=this,r=Array.from(t.columns||[]).map((function(e){return o._columnDefsByName.get(e)})),n=r.map((function(e){return e.sticky})),i=r.map((function(e){return e.stickyEnd}));this._stickyStyler.updateStickyColumns(e,n,i,!this._fixedLayout||this._forceRecalculateCellWidths)},e.prototype._getRenderedRows=function(e){for(var t=[],o=0;o<e.viewContainer.length;o++){var r=e.viewContainer.get(o);t.push(r.rootNodes[0])}return t},e.prototype._getRowDefs=function(e,t){if(1==this._rowDefs.length)return[this._rowDefs[0]];var o=[];if(this.multiTemplateDataRows)o=this._rowDefs.filter((function(o){return!o.when||o.when(t,e)}));else{var r=this._rowDefs.find((function(o){return o.when&&o.when(t,e)}))||this._defaultRowDef;r&&o.push(r)}return o},e.prototype._getEmbeddedViewArgs=function(e,t){return{templateRef:e.rowDef.template,context:{$implicit:e.data},index:t}},e.prototype._renderRow=function(e,t,o,r){void 0===r&&(r={});var n=e.viewContainer.createEmbeddedView(t.template,r,o);return this._renderCellTemplateForItem(t,r),n},e.prototype._renderCellTemplateForItem=function(e,t){var o,r;try{for(var n=h(this._getCellTemplates(e)),i=n.next();!i.done;i=n.next())B.mostRecentCellOutlet&&B.mostRecentCellOutlet._viewContainer.createEmbeddedView(i.value,t)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}this._changeDetectorRef.markForCheck()},e.prototype._updateRowIndexContext=function(){for(var e=this._rowOutlet.viewContainer,t=0,o=e.length;t<o;t++){var r=e.get(t).context;r.count=o,r.first=0===t,r.last=t===o-1,r.even=t%2==0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[t].dataIndex,r.renderIndex=t):r.index=this._renderRows[t].dataIndex}},e.prototype._getCellTemplates=function(e){var t=this;return e&&e.columns?Array.from(e.columns,(function(o){var r=t._columnDefsByName.get(o);return e.extractCellTemplate(r)})):[]},e.prototype._applyNativeTableSections=function(){var e,t,o,r,n=this._document.createDocumentFragment(),i=[{tag:"thead",outlets:[this._headerRowOutlet]},{tag:"tbody",outlets:[this._rowOutlet,this._noDataRowOutlet]},{tag:"tfoot",outlets:[this._footerRowOutlet]}];try{for(var s=h(i),a=s.next();!a.done;a=s.next()){var c=a.value,l=this._document.createElement(c.tag);l.setAttribute("role","rowgroup");try{for(var u=(o=void 0,h(c.outlets)),d=u.next();!d.done;d=u.next())l.appendChild(d.value.elementRef.nativeElement)}catch(e){o={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}n.appendChild(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}this._elementRef.nativeElement.appendChild(n)},e.prototype._forceRenderDataRows=function(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows()},e.prototype._checkStickyStates=function(){var e=function(e,t){return e||t.hasStickyChanged()};this._headerRowDefs.reduce(e,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,!1)&&(this._stickyColumnStylesNeedReset=!0,this.updateStickyColumnStyles())},e.prototype._setupStickyStyler=function(){var e=this;this._stickyStyler=new z(this._isNativeHtmlTable,this.stickyCssClass,this._dir?this._dir.value:"ltr",this._coalescedStyleScheduler,this._platform.isBrowser,this.needsPositionStickyOnElement,this._stickyPositioningListener),(this._dir?this._dir.change:c.of()).pipe(l.takeUntil(this._onDestroy)).subscribe((function(t){e._stickyStyler.direction=t,e.updateStickyColumnStyles()}))},e.prototype._getOwnDefs=function(e){var t=this;return e.filter((function(e){return!e._table||e._table===t}))},e.prototype._updateNoDataRow=function(){var e=this._customNoDataRow||this._noDataRow;if(e){var t=0===this._rowOutlet.viewContainer.length;if(t!==this._isShowingNoDataRow){var o=this._noDataRowOutlet.viewContainer;t?o.createEmbeddedView(e.templateRef):o.clear(),this._isShowingNoDataRow=t}}},e}());function X(e,t){return e.concat(Array.from(t))}
30
+ var V,M,U,W,q=["top","bottom","left","right"],z=function(){function e(e,t,o,r,n,i,s){void 0===n&&(n=!0),void 0===i&&(i=!0),this._isNativeHtmlTable=e,this._stickCellCss=t,this.direction=o,this._coalescedStyleScheduler=r,this._isBrowser=n,this._needsPositionStickyOnElement=i,this._positionListener=s,this._cachedCellWidths=[],this._borderCellCss={top:t+"-border-elem-top",bottom:t+"-border-elem-bottom",left:t+"-border-elem-left",right:t+"-border-elem-right"}}return e.prototype.clearStickyPositioning=function(e,t){var o,r,n=this,i=[];try{for(var s=h(e),a=s.next();!a.done;a=s.next()){var c=a.value;if(c.nodeType===c.ELEMENT_NODE){i.push(c);for(var l=0;l<c.children.length;l++)i.push(c.children[l])}}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}this._scheduleStyleChanges((function(){var e,o;try{for(var r=h(i),s=r.next();!s.done;s=r.next())n._removeStickyStyle(s.value,t)}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=r.return)&&o.call(r)}finally{if(e)throw e.error}}}))},e.prototype.updateStickyColumns=function(e,t,o,r){var n=this;if(void 0===r&&(r=!0),e.length&&this._isBrowser&&(t.some((function(e){return e}))||o.some((function(e){return e})))){var i=e[0],s=i.children.length,a=this._getCellWidths(i,r),c=this._getStickyStartColumnPositions(a,t),l=this._getStickyEndColumnPositions(a,o),u=t.lastIndexOf(!0),d=o.indexOf(!0);this._scheduleStyleChanges((function(){var r,i,f="rtl"===n.direction,p=f?"right":"left",y=f?"left":"right";try{for(var _=h(e),m=_.next();!m.done;m=_.next())for(var w=m.value,g=0;g<s;g++){var C=w.children[g];t[g]&&n._addStickyStyle(C,p,c[g],g===u),o[g]&&n._addStickyStyle(C,y,l[g],g===d)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=_.return)&&i.call(_)}finally{if(r)throw r.error}}n._positionListener&&(n._positionListener.stickyColumnsUpdated({sizes:-1===u?[]:a.slice(0,u+1).map((function(e,o){return t[o]?e:null}))}),n._positionListener.stickyEndColumnsUpdated({sizes:-1===d?[]:a.slice(d).map((function(e,t){return o[t+d]?e:null})).reverse()}))}))}else this._positionListener&&(this._positionListener.stickyColumnsUpdated({sizes:[]}),this._positionListener.stickyEndColumnsUpdated({sizes:[]}))},e.prototype.stickRows=function(e,t,o){var r=this;if(this._isBrowser){for(var n="bottom"===o?e.slice().reverse():e,i="bottom"===o?t.slice().reverse():t,s=[],a=[],c=[],l=0,u=0;l<n.length;l++)if(s[l]=u,i[l]){var d=n[l];c[l]=this._isNativeHtmlTable?Array.from(d.children):[d];var f=d.getBoundingClientRect().height;u+=f,a[l]=f}var p=i.lastIndexOf(!0);this._scheduleStyleChanges((function(){for(var e,t,l,u,d=0;d<n.length;d++)if(i[d]){var f=s[d],y=d===p;try{for(var _=(e=void 0,h(c[d])),m=_.next();!m.done;m=_.next())r._addStickyStyle(m.value,o,f,y)}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=_.return)&&t.call(_)}finally{if(e)throw e.error}}}"top"===o?null===(l=r._positionListener)||void 0===l||l.stickyHeaderRowsUpdated({sizes:a,elements:c}):null===(u=r._positionListener)||void 0===u||u.stickyFooterRowsUpdated({sizes:a,elements:c})}))}},e.prototype.updateStickyFooterContainer=function(e,t){var o=this;if(this._isNativeHtmlTable){var r=e.querySelector("tfoot");this._scheduleStyleChanges((function(){t.some((function(e){return!e}))?o._removeStickyStyle(r,["bottom"]):o._addStickyStyle(r,"bottom",0,!1)}))}},e.prototype._removeStickyStyle=function(e,t){var o,r;try{for(var n=h(t),i=n.next();!i.done;i=n.next()){var s=i.value;e.style[s]="",e.classList.remove(this._borderCellCss[s])}}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}q.some((function(o){return-1===t.indexOf(o)&&e.style[o]}))?e.style.zIndex=this._getCalculatedZIndex(e):(e.style.zIndex="",this._needsPositionStickyOnElement&&(e.style.position=""),e.classList.remove(this._stickCellCss))},e.prototype._addStickyStyle=function(e,t,o,r){e.classList.add(this._stickCellCss),r&&e.classList.add(this._borderCellCss[t]),e.style[t]=o+"px",e.style.zIndex=this._getCalculatedZIndex(e),this._needsPositionStickyOnElement&&(e.style.cssText+="position: -webkit-sticky; position: sticky; ")},e.prototype._getCalculatedZIndex=function(e){var t,o,r={top:100,bottom:10,left:1,right:1},n=0;try{for(var i=h(q),s=i.next();!s.done;s=i.next()){var a=s.value;e.style[a]&&(n+=r[a])}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}return n?""+n:""},e.prototype._getCellWidths=function(e,t){if(void 0===t&&(t=!0),!t&&this._cachedCellWidths.length)return this._cachedCellWidths;for(var o=[],r=e.children,n=0;n<r.length;n++)o.push(r[n].getBoundingClientRect().width);return this._cachedCellWidths=o,o},e.prototype._getStickyStartColumnPositions=function(e,t){for(var o=[],r=0,n=0;n<e.length;n++)t[n]&&(o[n]=r,r+=e[n]);return o},e.prototype._getStickyEndColumnPositions=function(e,t){for(var o=[],r=0,n=e.length;n>0;n--)t[n]&&(o[n]=r,r+=e[n]);return o},e.prototype._scheduleStyleChanges=function(e){this._coalescedStyleScheduler?this._coalescedStyleScheduler.schedule(e):e()},e}(),K=new a.InjectionToken("CDK_SPL");(V=function V(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[rowOutlet]"}]}],V.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(M=function M(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[headerRowOutlet]"}]}],M.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(U=function U(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[footerRowOutlet]"}]}],U.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},(W=function W(e,t){this.viewContainer=e,this.elementRef=t}).decorators=[{type:a.Directive,args:[{selector:"[noDataRowOutlet]"}]}],W.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]};var Z,Y='\n <ng-content select="caption"></ng-content>\n <ng-content select="colgroup, col"></ng-content>\n <ng-container headerRowOutlet></ng-container>\n <ng-container rowOutlet></ng-container>\n <ng-container noDataRowOutlet></ng-container>\n <ng-container footerRowOutlet></ng-container>\n',G=(d((function $(){return null!==Z&&Z.apply(this,arguments)||this}),Z=a.EmbeddedViewRef),function(){function e(e,t,o,r,n,i,s,a,l,u,d){this._differs=e,this._changeDetectorRef=t,this._elementRef=o,this._dir=n,this._platform=s,this._viewRepeater=a,this._coalescedStyleScheduler=l,this._stickyPositioningListener=u,this._viewportRuler=d,this._onDestroy=new c.Subject,this._columnDefsByName=new Map,this._customColumnDefs=new Set,this._customRowDefs=new Set,this._customHeaderRowDefs=new Set,this._customFooterRowDefs=new Set,this._headerRowDefChanged=!0,this._footerRowDefChanged=!0,this._stickyColumnStylesNeedReset=!0,this._forceRecalculateCellWidths=!0,this._cachedRenderRowsMap=new Map,this.stickyCssClass="cdk-table-sticky",this.needsPositionStickyOnElement=!0,this._isShowingNoDataRow=!1,this._multiTemplateDataRows=!1,this._fixedLayout=!1,this.viewChange=new c.BehaviorSubject({start:0,end:Number.MAX_VALUE}),r||this._elementRef.nativeElement.setAttribute("role","grid"),this._document=i,this._isNativeHtmlTable="TABLE"===this._elementRef.nativeElement.nodeName}return Object.defineProperty(e.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(e){this._trackByFn=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource!==e&&this._switchDataSource(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multiTemplateDataRows",{get:function(){return this._multiTemplateDataRows},set:function(e){this._multiTemplateDataRows=o.coerceBooleanProperty(e),this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fixedLayout",{get:function(){return this._fixedLayout},set:function(e){this._fixedLayout=o.coerceBooleanProperty(e),this._forceRecalculateCellWidths=!0,this._stickyColumnStylesNeedReset=!0},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this._setupStickyStyler(),this._isNativeHtmlTable&&this._applyNativeTableSections(),this._dataDiffer=this._differs.find([]).create((function(t,o){return e.trackBy?e.trackBy(o.dataIndex,o.data):o})),this._viewportRuler&&this._viewportRuler.change().pipe(l.takeUntil(this._onDestroy)).subscribe((function(){e._forceRecalculateCellWidths=!0}))},e.prototype.ngAfterContentChecked=function(){this._cacheRowDefs(),this._cacheColumnDefs();var e=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||e,this._forceRecalculateCellWidths=e,this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=!1),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=!1),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription?this._observeRenderChanges():this._stickyColumnStylesNeedReset&&this.updateStickyColumnStyles(),this._checkStickyStates()},e.prototype.ngOnDestroy=function(){this._rowOutlet.viewContainer.clear(),this._noDataRowOutlet.viewContainer.clear(),this._headerRowOutlet.viewContainer.clear(),this._footerRowOutlet.viewContainer.clear(),this._cachedRenderRowsMap.clear(),this._onDestroy.next(),this._onDestroy.complete(),r.isDataSource(this.dataSource)&&this.dataSource.disconnect(this)},e.prototype.renderRows=function(){var e=this;this._renderRows=this._getAllRenderRows();var t=this._dataDiffer.diff(this._renderRows);if(t){var o=this._rowOutlet.viewContainer;this._viewRepeater?this._viewRepeater.applyChanges(t,o,(function(t,o,r){return e._getEmbeddedViewArgs(t.item,r)}),(function(e){return e.item.data}),(function(t){1===t.operation&&t.context&&e._renderCellTemplateForItem(t.record.item.rowDef,t.context)})):t.forEachOperation((function(t,r,n){if(null==t.previousIndex){var i=t.item;e._renderRow(e._rowOutlet,i.rowDef,n,{$implicit:i.data})}else if(null==n)o.remove(r);else{var s=o.get(r);o.move(s,n)}})),this._updateRowIndexContext(),t.forEachIdentityChange((function(e){o.get(e.currentIndex).context.$implicit=e.item.data})),this._updateNoDataRow(),this.updateStickyColumnStyles()}else this._updateNoDataRow()},e.prototype.addColumnDef=function(e){this._customColumnDefs.add(e)},e.prototype.removeColumnDef=function(e){this._customColumnDefs.delete(e)},e.prototype.addRowDef=function(e){this._customRowDefs.add(e)},e.prototype.removeRowDef=function(e){this._customRowDefs.delete(e)},e.prototype.addHeaderRowDef=function(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=!0},e.prototype.removeHeaderRowDef=function(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=!0},e.prototype.addFooterRowDef=function(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=!0},e.prototype.removeFooterRowDef=function(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=!0},e.prototype.setNoDataRow=function(e){this._customNoDataRow=e},e.prototype.updateStickyHeaderRowStyles=function(){var e=this._getRenderedRows(this._headerRowOutlet),t=this._elementRef.nativeElement.querySelector("thead");t&&(t.style.display=e.length?"":"none");var o=this._headerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,o,"top"),this._headerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyFooterRowStyles=function(){var e=this._getRenderedRows(this._footerRowOutlet),t=this._elementRef.nativeElement.querySelector("tfoot");t&&(t.style.display=e.length?"":"none");var o=this._footerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,o,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,o),this._footerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyColumnStyles=function(){var e=this,t=this._getRenderedRows(this._headerRowOutlet),o=this._getRenderedRows(this._rowOutlet),r=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this._fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning(p(t,o,r),["left","right"]),this._stickyColumnStylesNeedReset=!1),t.forEach((function(t,o){e._addStickyColumnStyles([t],e._headerRowDefs[o])})),this._rowDefs.forEach((function(t){for(var r=[],n=0;n<o.length;n++)e._renderRows[n].rowDef===t&&r.push(o[n]);e._addStickyColumnStyles(r,t)})),r.forEach((function(t,o){e._addStickyColumnStyles([t],e._footerRowDefs[o])})),Array.from(this._columnDefsByName.values()).forEach((function(e){return e.resetStickyChanged()}))},e.prototype._getAllRenderRows=function(){var e=[],t=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(var o=0;o<this._data.length;o++){var r=this._data[o],n=this._getRenderRowsForData(r,o,t.get(r));this._cachedRenderRowsMap.has(r)||this._cachedRenderRowsMap.set(r,new WeakMap);for(var i=0;i<n.length;i++){var s=n[i],a=this._cachedRenderRowsMap.get(s.data);a.has(s.rowDef)?a.get(s.rowDef).push(s):a.set(s.rowDef,[s]),e.push(s)}}return e},e.prototype._getRenderRowsForData=function(e,t,o){return this._getRowDefs(e,t).map((function(r){var n=o&&o.has(r)?o.get(r):[];if(n.length){var i=n.shift();return i.dataIndex=t,i}return{data:e,rowDef:r,dataIndex:t}}))},e.prototype._cacheColumnDefs=function(){var e=this;this._columnDefsByName.clear(),X(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach((function(t){e._columnDefsByName.has(t.name),e._columnDefsByName.set(t.name,t)}))},e.prototype._cacheRowDefs=function(){this._headerRowDefs=X(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=X(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=X(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);var e=this._rowDefs.filter((function(e){return!e.when}));this._defaultRowDef=e[0]},e.prototype._renderUpdatedColumns=function(){var e=function(e,t){return e||!!t.getColumnsDiff()},t=this._rowDefs.reduce(e,!1);t&&this._forceRenderDataRows();var o=this._headerRowDefs.reduce(e,!1);o&&this._forceRenderHeaderRows();var r=this._footerRowDefs.reduce(e,!1);return r&&this._forceRenderFooterRows(),t||o||r},e.prototype._switchDataSource=function(e){this._data=[],r.isDataSource(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear()),this._dataSource=e},e.prototype._observeRenderChanges=function(){var e,t=this;this.dataSource&&(r.isDataSource(this.dataSource)?e=this.dataSource.connect(this):c.isObservable(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=c.of(this.dataSource)),this._renderChangeSubscription=e.pipe(l.takeUntil(this._onDestroy)).subscribe((function(e){t._data=e||[],t.renderRows()})))},e.prototype._forceRenderHeaderRows=function(){var e=this;this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((function(t,o){return e._renderRow(e._headerRowOutlet,t,o)})),this.updateStickyHeaderRowStyles()},e.prototype._forceRenderFooterRows=function(){var e=this;this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((function(t,o){return e._renderRow(e._footerRowOutlet,t,o)})),this.updateStickyFooterRowStyles()},e.prototype._addStickyColumnStyles=function(e,t){var o=this,r=Array.from(t.columns||[]).map((function(e){return o._columnDefsByName.get(e)})),n=r.map((function(e){return e.sticky})),i=r.map((function(e){return e.stickyEnd}));this._stickyStyler.updateStickyColumns(e,n,i,!this._fixedLayout||this._forceRecalculateCellWidths)},e.prototype._getRenderedRows=function(e){for(var t=[],o=0;o<e.viewContainer.length;o++){var r=e.viewContainer.get(o);t.push(r.rootNodes[0])}return t},e.prototype._getRowDefs=function(e,t){if(1==this._rowDefs.length)return[this._rowDefs[0]];var o=[];if(this.multiTemplateDataRows)o=this._rowDefs.filter((function(o){return!o.when||o.when(t,e)}));else{var r=this._rowDefs.find((function(o){return o.when&&o.when(t,e)}))||this._defaultRowDef;r&&o.push(r)}return o},e.prototype._getEmbeddedViewArgs=function(e,t){return{templateRef:e.rowDef.template,context:{$implicit:e.data},index:t}},e.prototype._renderRow=function(e,t,o,r){void 0===r&&(r={});var n=e.viewContainer.createEmbeddedView(t.template,r,o);return this._renderCellTemplateForItem(t,r),n},e.prototype._renderCellTemplateForItem=function(e,t){var o,r;try{for(var n=h(this._getCellTemplates(e)),i=n.next();!i.done;i=n.next())B.mostRecentCellOutlet&&B.mostRecentCellOutlet._viewContainer.createEmbeddedView(i.value,t)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}this._changeDetectorRef.markForCheck()},e.prototype._updateRowIndexContext=function(){for(var e=this._rowOutlet.viewContainer,t=0,o=e.length;t<o;t++){var r=e.get(t).context;r.count=o,r.first=0===t,r.last=t===o-1,r.even=t%2==0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[t].dataIndex,r.renderIndex=t):r.index=this._renderRows[t].dataIndex}},e.prototype._getCellTemplates=function(e){var t=this;return e&&e.columns?Array.from(e.columns,(function(o){var r=t._columnDefsByName.get(o);return e.extractCellTemplate(r)})):[]},e.prototype._applyNativeTableSections=function(){var e,t,o,r,n=this._document.createDocumentFragment(),i=[{tag:"thead",outlets:[this._headerRowOutlet]},{tag:"tbody",outlets:[this._rowOutlet,this._noDataRowOutlet]},{tag:"tfoot",outlets:[this._footerRowOutlet]}];try{for(var s=h(i),a=s.next();!a.done;a=s.next()){var c=a.value,l=this._document.createElement(c.tag);l.setAttribute("role","rowgroup");try{for(var u=(o=void 0,h(c.outlets)),d=u.next();!d.done;d=u.next())l.appendChild(d.value.elementRef.nativeElement)}catch(e){o={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}n.appendChild(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}this._elementRef.nativeElement.appendChild(n)},e.prototype._forceRenderDataRows=function(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows()},e.prototype._checkStickyStates=function(){var e=function(e,t){return e||t.hasStickyChanged()};this._headerRowDefs.reduce(e,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,!1)&&(this._stickyColumnStylesNeedReset=!0,this.updateStickyColumnStyles())},e.prototype._setupStickyStyler=function(){var e=this;this._stickyStyler=new z(this._isNativeHtmlTable,this.stickyCssClass,this._dir?this._dir.value:"ltr",this._coalescedStyleScheduler,this._platform.isBrowser,this.needsPositionStickyOnElement,this._stickyPositioningListener),(this._dir?this._dir.change:c.of()).pipe(l.takeUntil(this._onDestroy)).subscribe((function(t){e._stickyStyler.direction=t,e.updateStickyColumnStyles()}))},e.prototype._getOwnDefs=function(e){var t=this;return e.filter((function(e){return!e._table||e._table===t}))},e.prototype._updateNoDataRow=function(){var e=this._customNoDataRow||this._noDataRow;if(e){var t=0===this._rowOutlet.viewContainer.length;if(t!==this._isShowingNoDataRow){var o=this._noDataRowOutlet.viewContainer;t?o.createEmbeddedView(e.templateRef):o.clear(),this._isShowingNoDataRow=t}}},e}());function X(e,t){return e.concat(Array.from(t))}
31
31
  /**
32
32
  * @license
33
33
  * Copyright Google LLC All Rights Reserved.