/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { ContentChild, Directive, ElementRef, Inject, Input, Optional, TemplateRef, } from '@angular/core'; import { mixinHasStickyInput } from './can-stick'; import { CDK_TABLE } from './tokens'; import * as i0 from "@angular/core"; /** * Cell definition for a CDK table. * Captures the template of a column's data row cell as well as cell-specific properties. */ export class CdkCellDef { constructor(/** @docs-private */ template) { this.template = template; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkCellDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkCellDef, selector: "[cdkCellDef]", ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkCellDef, decorators: [{ type: Directive, args: [{ selector: '[cdkCellDef]' }] }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } }); /** * Header cell definition for a CDK table. * Captures the template of a column's header cell and as well as cell-specific properties. */ export class CdkHeaderCellDef { constructor(/** @docs-private */ template) { this.template = template; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkHeaderCellDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]", ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkHeaderCellDef, decorators: [{ type: Directive, args: [{ selector: '[cdkHeaderCellDef]' }] }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } }); /** * Footer cell definition for a CDK table. * Captures the template of a column's footer cell and as well as cell-specific properties. */ export class CdkFooterCellDef { constructor(/** @docs-private */ template) { this.template = template; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkFooterCellDef, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkFooterCellDef, selector: "[cdkFooterCellDef]", ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkFooterCellDef, decorators: [{ type: Directive, args: [{ selector: '[cdkFooterCellDef]' }] }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } }); // Boilerplate for applying mixins to CdkColumnDef. /** @docs-private */ class CdkColumnDefBase { } const _CdkColumnDefBase = mixinHasStickyInput(CdkColumnDefBase); /** * Column definition for the CDK table. * Defines a set of cells available for a table column. */ export class CdkColumnDef extends _CdkColumnDefBase { /** Unique name for this column. */ get name() { return this._name; } set name(name) { this._setNameInput(name); } /** * Whether this column should be sticky positioned on the end of the row. Should make sure * that it mimics the `CanStick` mixin such that `_hasStickyChanged` is set to true if the value * has been changed. */ get stickyEnd() { return this._stickyEnd; } set stickyEnd(v) { const prevValue = this._stickyEnd; this._stickyEnd = coerceBooleanProperty(v); this._hasStickyChanged = prevValue !== this._stickyEnd; } constructor(_table) { super(); this._table = _table; this._stickyEnd = false; } /** * Overridable method that sets the css classes that will be added to every cell in this * column. * In the future, columnCssClassName will change from type string[] to string and this * will set a single string value. * @docs-private */ _updateColumnCssClassName() { this._columnCssClassName = [`cdk-column-${this.cssClassFriendlyName}`]; } /** * This has been extracted to a util because of TS 4 and VE. * View Engine doesn't support property rename inheritance. * TS 4.0 doesn't allow properties to override accessors or vice-versa. * @docs-private */ _setNameInput(value) { // If the directive is set without a name (updated programmatically), then this setter will // trigger with an empty string and should not overwrite the programmatically set value. if (value) { this._name = value; this.cssClassFriendlyName = value.replace(/[^a-z0-9_-]/gi, '-'); this._updateColumnCssClassName(); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkColumnDef, deps: [{ token: CDK_TABLE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: { sticky: "sticky", name: ["cdkColumnDef", "name"], stickyEnd: "stickyEnd" }, providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }], queries: [{ propertyName: "cell", first: true, predicate: CdkCellDef, descendants: true }, { propertyName: "headerCell", first: true, predicate: CdkHeaderCellDef, descendants: true }, { propertyName: "footerCell", first: true, predicate: CdkFooterCellDef, descendants: true }], usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkColumnDef, decorators: [{ type: Directive, args: [{ selector: '[cdkColumnDef]', inputs: ['sticky'], providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }], }] }], ctorParameters: function () { return [{ type: undefined, decorators: [{ type: Inject, args: [CDK_TABLE] }, { type: Optional }] }]; }, propDecorators: { name: [{ type: Input, args: ['cdkColumnDef'] }], stickyEnd: [{ type: Input, args: ['stickyEnd'] }], cell: [{ type: ContentChild, args: [CdkCellDef] }], headerCell: [{ type: ContentChild, args: [CdkHeaderCellDef] }], footerCell: [{ type: ContentChild, args: [CdkFooterCellDef] }] } }); /** Base class for the cells. Adds a CSS classname that identifies the column it renders in. */ export class BaseCdkCell { constructor(columnDef, elementRef) { elementRef.nativeElement.classList.add(...columnDef._columnCssClassName); } } /** Header cell template container that adds the right classes and role. */ export class CdkHeaderCell extends BaseCdkCell { constructor(columnDef, elementRef) { super(columnDef, elementRef); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkHeaderCell, deps: [{ token: CdkColumnDef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]", host: { attributes: { "role": "columnheader" }, classAttribute: "cdk-header-cell" }, usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkHeaderCell, decorators: [{ type: Directive, args: [{ selector: 'cdk-header-cell, th[cdk-header-cell]', host: { 'class': 'cdk-header-cell', 'role': 'columnheader', }, }] }], ctorParameters: function () { return [{ type: CdkColumnDef }, { type: i0.ElementRef }]; } }); /** Footer cell template container that adds the right classes and role. */ export class CdkFooterCell extends BaseCdkCell { constructor(columnDef, elementRef) { super(columnDef, elementRef); if (columnDef._table?._elementRef.nativeElement.nodeType === 1) { const tableRole = columnDef._table._elementRef.nativeElement.getAttribute('role'); const role = tableRole === 'grid' || tableRole === 'treegrid' ? 'gridcell' : 'cell'; elementRef.nativeElement.setAttribute('role', role); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkFooterCell, deps: [{ token: CdkColumnDef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkFooterCell, selector: "cdk-footer-cell, td[cdk-footer-cell]", host: { classAttribute: "cdk-footer-cell" }, usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkFooterCell, decorators: [{ type: Directive, args: [{ selector: 'cdk-footer-cell, td[cdk-footer-cell]', host: { 'class': 'cdk-footer-cell', }, }] }], ctorParameters: function () { return [{ type: CdkColumnDef }, { type: i0.ElementRef }]; } }); /** Cell template container that adds the right classes and role. */ export class CdkCell extends BaseCdkCell { constructor(columnDef, elementRef) { super(columnDef, elementRef); if (columnDef._table?._elementRef.nativeElement.nodeType === 1) { const tableRole = columnDef._table._elementRef.nativeElement.getAttribute('role'); const role = tableRole === 'grid' || tableRole === 'treegrid' ? 'gridcell' : 'cell'; elementRef.nativeElement.setAttribute('role', role); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkCell, deps: [{ token: CdkColumnDef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: CdkCell, selector: "cdk-cell, td[cdk-cell]", host: { classAttribute: "cdk-cell" }, usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: CdkCell, decorators: [{ type: Directive, args: [{ selector: 'cdk-cell, td[cdk-cell]', host: { 'class': 'cdk-cell', }, }] }], ctorParameters: function () { return [{ type: CdkColumnDef }, { type: i0.ElementRef }]; } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvdGFibGUvY2VsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQWUscUJBQXFCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUMxRSxPQUFPLEVBQ0wsWUFBWSxFQUNaLFNBQVMsRUFDVCxVQUFVLEVBQ1YsTUFBTSxFQUNOLEtBQUssRUFDTCxRQUFRLEVBQ1IsV0FBVyxHQUN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