@alyle/ui
Version:
Minimal Design, a set of components for Angular
617 lines (608 loc) • 39.3 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, booleanAttribute, Input, Attribute, Optional, Inject, SkipSelf, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
import * as i1$2 from '@angular/cdk/table';
import { CdkTable, _COALESCED_STYLE_SCHEDULER, STICKY_POSITIONING_LISTENER, CDK_TABLE, _CoalescedStyleScheduler, CDK_TABLE_TEMPLATE, CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkHeaderCell, CdkFooterCell, CdkCell, CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef, CdkHeaderRow, CDK_ROW_TEMPLATE, CdkFooterRow, CdkRow, CdkNoDataRow, CdkTextColumn, CdkTableModule } from '@angular/cdk/table';
import { _RecycleViewRepeaterStrategy, _VIEW_REPEATER_STRATEGY, _DisposeViewRepeaterStrategy } from '@angular/cdk/collections';
import * as i1$1 from '@alyle/ui';
import { st2c, StyleCollection, StyleRenderer, ck, LyCommonModule } from '@alyle/ui';
import { DOCUMENT } from '@angular/common';
import * as i1 from '@angular/cdk/bidi';
import * as i2 from '@angular/cdk/platform';
import * as i3 from '@angular/cdk/scrolling';
const STYLES = (theme, ref) => {
const { before, after } = theme;
const __ = ref.selectorsOf(STYLES);
return {
$name: `LyTable`,
$global: () => (_className) => `${_className} ${__.root} thead,${_className} ${__.root} tbody,${_className} ${__.root} tfoot,${_className} ${__.headerRow},${_className} ${__.row},${_className} ${__.footerRow},${_className} [ly-header-row],${_className} [ly-row],${_className} [ly-footer-row],${_className} ${__.sticky}{background:inherit;}${_className} th${__.headerCell}:first-of-type,${_className} td${__.cell}:first-of-type,${_className} td${__.footerCell}:first-of-type{padding-${before}:24px;}${_className} th${__.headerCell}:last-of-type,${_className} td${__.cell}:last-of-type,${_className} td${__.footerCell}:last-of-type{padding-${after}:24px;}${_className} th${__.headerCell},${_className} td${__.cell},${_className} td${__.footerCell}{padding:0;border-bottom-width:1px;border-bottom-style:solid;}${_className} th${__.headerCell}{text-align:${before};}${_className} tr${__.row},${_className} tr${__.footerRow}{height:48px;}${_className} ${__.row},${_className} ${__.headerRow},${_className} ${__.footerRow},${_className} th${__.headerCell},${_className} td${__.cell},${_className} td${__.footerCell}{border-bottom-color:${theme.divider};}${_className} ${__.cell},${_className} ${__.footerCell}{color:${theme.text.primary};font-size:14px;}${_className} ly-table{display:block;}${_className} ly-header-row{min-height:56px;}${_className} ly-row,${_className} ly-footer-row{min-height:48px;}${_className} ly-row,${_className} ly-header-row,${_className} ly-footer-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box;}${_className} ly-cell:first-of-type,${_className} ly-header-cell:first-of-type,${_className} ly-footer-cell:first-of-type{padding-${before}:24px;}${_className} ly-cell:last-of-type,${_className} ly-header-cell:last-of-type,${_className} ly-footer-cell:last-of-type{padding-${after}:24px;}${_className} ly-cell,${_className} ly-header-cell,${_className} ly-footer-cell{flex:1;display:flex;align-items:center;overflow:hidden;word-wrap:break-word;min-height:inherit;}`,
root: () => (_className) => `${_className}{font-family:Roboto,Helvetica Neue,sans-serif;background:${theme.paper.default};}table${_className}{border-spacing:0;}${st2c(((theme.table
&& theme.table.root
&& (theme.table.root instanceof StyleCollection
? theme.table.root.setTransformer(fn => fn(__)).css
: theme.table.root(__)))), `${_className}`)}`,
column: null,
headerCell: (_className) => `${_className}{color:${theme.text.secondary};font-size:12px;font-weight:500;}`,
footerCell: null,
cell: null,
row: null,
headerRow: (_className) => `tr${_className}{height:56px;}`,
footerRow: null,
sticky: (_className) => `${_className}{position:sticky !important;}`,
noDataRow: null,
fixedLayout: (_className) => `${_className}{table-layout:fixed;}`
};
};
/**
* Enables the recycle view repeater strategy, which reduces rendering latency. Not compatible with
* tables that animate rows.
*/
class LyRecycleRows {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRecycleRows, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyRecycleRows, isStandalone: false, selector: "ly-table[recycleRows], table[ly-table][recycleRows]", providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRecycleRows, decorators: [{
type: Directive,
args: [{
selector: 'ly-table[recycleRows], table[ly-table][recycleRows]',
providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }],
standalone: false
}]
}] });
/**
* Wrapper for the CdkTable with Material design styles.
*/
class LyTable extends CdkTable {
/**
* Whether to use a fixed table layout. Enabling this option will enforce consistent column widths
* and optimize rendering sticky styles for native tables. No-op for flex tables.
*/
get fixedLayout() {
return super.fixedLayout;
}
set fixedLayout(v) {
super.fixedLayout = v;
const newVal = super.fixedLayout;
this.sRenderer.toggleClass(this.classes.fixedLayout, newVal);
}
constructor(_differs, _changeDetectorRef, _elementRef, role, _dir, _document, _platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener, _ngZone, sRenderer) {
super(_differs, _changeDetectorRef, _elementRef, role, _dir, _document, _platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener, _ngZone);
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'root');
/** Overrides the sticky CSS class set by the `CdkTable`. */
this.stickyCssClass = this.classes.sticky;
/** Overrides the need to add position: sticky on every sticky cell element in `CdkTable`. */
this.needsPositionStickyOnElement = false;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTable, 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 }, { token: i0.NgZone, optional: true }, { token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: LyTable, isStandalone: false, selector: "ly-table, table[ly-table]", inputs: { fixedLayout: ["fixedLayout", "fixedLayout", booleanAttribute] }, providers: [
StyleRenderer,
{ provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
{ provide: CdkTable, useExisting: LyTable },
{ provide: CDK_TABLE, useExisting: LyTable },
{ provide: _COALESCED_STYLE_SCHEDULER, useClass: _CoalescedStyleScheduler },
// Prevent nested tables from seeing this table's StickyPositioningListener.
{ provide: STICKY_POSITIONING_LISTENER, useValue: null },
], exportAs: ["lyTable"], usesInheritance: true, ngImport: i0, template: "\n <ng-content select=\"caption\"/>\n <ng-content select=\"colgroup, col\"/>\n\n <!--\n Unprojected content throws a hydration error so we need this to capture it.\n It gets removed on the client so it doesn't affect the layout.\n -->\n @if (_isServer) {\n <ng-content/>\n }\n\n @if (_isNativeHtmlTable) {\n <thead role=\"rowgroup\">\n <ng-container headerRowOutlet/>\n </thead>\n <tbody role=\"rowgroup\">\n <ng-container rowOutlet/>\n <ng-container noDataRowOutlet/>\n </tbody>\n <tfoot role=\"rowgroup\">\n <ng-container footerRowOutlet/>\n </tfoot>\n } @else {\n <ng-container headerRowOutlet/>\n <ng-container rowOutlet/>\n <ng-container noDataRowOutlet/>\n <ng-container footerRowOutlet/>\n }\n", isInline: true, dependencies: [{ kind: "directive", type: i1$2.DataRowOutlet, selector: "[rowOutlet]" }, { kind: "directive", type: i1$2.HeaderRowOutlet, selector: "[headerRowOutlet]" }, { kind: "directive", type: i1$2.FooterRowOutlet, selector: "[footerRowOutlet]" }, { kind: "directive", type: i1$2.NoDataRowOutlet, selector: "[noDataRowOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTable, decorators: [{
type: Component,
args: [{
selector: 'ly-table, table[ly-table]',
exportAs: 'lyTable',
template: CDK_TABLE_TEMPLATE,
providers: [
StyleRenderer,
{ provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
{ provide: CdkTable, useExisting: LyTable },
{ provide: CDK_TABLE, useExisting: LyTable },
{ provide: _COALESCED_STYLE_SCHEDULER, useClass: _CoalescedStyleScheduler },
// Prevent nested tables from seeing this table's StickyPositioningListener.
{ provide: STICKY_POSITIONING_LISTENER, useValue: null },
],
encapsulation: ViewEncapsulation.None,
// See note on CdkTable for explanation on why this uses the default change detection strategy.
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
standalone: false
}]
}], ctorParameters: () => [{ type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: undefined, decorators: [{
type: Attribute,
args: ['role']
}] }, { type: i1.Directionality, decorators: [{
type: Optional
}] }, { type: undefined, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }, { type: i2.Platform }, { type: undefined, decorators: [{
type: Inject,
args: [_VIEW_REPEATER_STRATEGY]
}] }, { type: i1$2._CoalescedStyleScheduler, decorators: [{
type: Inject,
args: [_COALESCED_STYLE_SCHEDULER]
}] }, { type: i3.ViewportRuler }, { type: undefined, decorators: [{
type: Optional
}, {
type: SkipSelf
}, {
type: Inject,
args: [STICKY_POSITIONING_LISTENER]
}] }, { type: i0.NgZone, decorators: [{
type: Optional
}] }, { type: i1$1.StyleRenderer }], propDecorators: { fixedLayout: [{
type: Input,
args: [{ transform: booleanAttribute }]
}] } });
/**
* Cell definition for the ly-table.
* Captures the template of a column's data row cell as well as cell-specific properties.
*/
class LyCellDef extends CdkCellDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyCellDef, isStandalone: false, selector: "[lyCellDef]", providers: [{ provide: CdkCellDef, useExisting: LyCellDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyCellDef, decorators: [{
type: Directive,
args: [{
selector: '[lyCellDef]',
providers: [{ provide: CdkCellDef, useExisting: LyCellDef }],
standalone: false
}]
}] });
/**
* Header cell definition for the ly-table.
* Captures the template of a column's header cell and as well as cell-specific properties.
*/
class LyHeaderCellDef extends CdkHeaderCellDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyHeaderCellDef, isStandalone: false, selector: "[lyHeaderCellDef]", providers: [{ provide: CdkHeaderCellDef, useExisting: LyHeaderCellDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderCellDef, decorators: [{
type: Directive,
args: [{
selector: '[lyHeaderCellDef]',
providers: [{ provide: CdkHeaderCellDef, useExisting: LyHeaderCellDef }],
standalone: false
}]
}] });
/**
* Footer cell definition for the ly-table.
* Captures the template of a column's footer cell and as well as cell-specific properties.
*/
class LyFooterCellDef extends CdkFooterCellDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyFooterCellDef, isStandalone: false, selector: "[lyFooterCellDef]", providers: [{ provide: CdkFooterCellDef, useExisting: LyFooterCellDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterCellDef, decorators: [{
type: Directive,
args: [{
selector: '[lyFooterCellDef]',
providers: [{ provide: CdkFooterCellDef, useExisting: LyFooterCellDef }],
standalone: false
}]
}] });
/**
* Column definition for the ly-table.
* Defines a set of cells available for a table column.
*/
class LyColumnDef extends CdkColumnDef {
/** Unique name for this column. */
get name() {
return this._name;
}
set name(name) {
this._setNameInput(name);
}
/**
* Add "ly-column-" prefix in addition to "cdk-column-" prefix.
* In the future, this will only add "ly-column-" and columnCssClassName
* will change from type string[] to string.
* @docs-private
*/
_updateColumnCssClassName() {
super._updateColumnCssClassName();
if (this._table) {
this._columnCssClassName.push(`${this._table.classes.column}-${this.cssClassFriendlyName}`);
}
this._columnCssClassName.push(ck(`ly-column-${this.cssClassFriendlyName}`));
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyColumnDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyColumnDef, isStandalone: false, selector: "[lyColumnDef]", inputs: { name: ["lyColumnDef", "name"] }, providers: [
{ provide: CdkColumnDef, useExisting: LyColumnDef },
{ provide: 'LY_SORT_HEADER_COLUMN_DEF', useExisting: LyColumnDef },
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyColumnDef, decorators: [{
type: Directive,
args: [{
selector: '[lyColumnDef]',
providers: [
{ provide: CdkColumnDef, useExisting: LyColumnDef },
{ provide: 'LY_SORT_HEADER_COLUMN_DEF', useExisting: LyColumnDef },
],
standalone: false
}]
}], propDecorators: { name: [{
type: Input,
args: ['lyColumnDef']
}] } });
/** Header cell template container that adds the right classes and role. */
class LyHeaderCell extends CdkHeaderCell {
constructor(columnDef, elementRef, sRenderer) {
super(columnDef, elementRef);
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'headerCell');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderCell, deps: [{ token: i1$2.CdkColumnDef }, { token: i0.ElementRef }, { token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyHeaderCell, isStandalone: false, selector: "ly-header-cell, th[ly-header-cell]", host: { attributes: { "role": "columnheader" } }, providers: [
StyleRenderer
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderCell, decorators: [{
type: Directive,
args: [{
selector: 'ly-header-cell, th[ly-header-cell]',
host: {
'role': 'columnheader',
},
providers: [
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$2.CdkColumnDef }, { type: i0.ElementRef }, { type: i1$1.StyleRenderer }] });
/** Footer cell template container that adds the right classes and role. */
class LyFooterCell extends CdkFooterCell {
constructor(columnDef, elementRef, sRenderer) {
super(columnDef, elementRef);
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'footerCell');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterCell, deps: [{ token: i1$2.CdkColumnDef }, { token: i0.ElementRef }, { token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyFooterCell, isStandalone: false, selector: "ly-footer-cell, td[ly-footer-cell]", host: { attributes: { "role": "gridcell" } }, providers: [
StyleRenderer
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterCell, decorators: [{
type: Directive,
args: [{
selector: 'ly-footer-cell, td[ly-footer-cell]',
host: {
'role': 'gridcell',
},
providers: [
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$2.CdkColumnDef }, { type: i0.ElementRef }, { type: i1$1.StyleRenderer }] });
/** Cell template container that adds the right classes and role. */
class LyCell extends CdkCell {
constructor(columnDef, elementRef, sRenderer) {
super(columnDef, elementRef);
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'cell');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyCell, deps: [{ token: i1$2.CdkColumnDef }, { token: i0.ElementRef }, { token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyCell, isStandalone: false, selector: "ly-cell, td[ly-cell]", host: { attributes: { "role": "gridcell" } }, providers: [
StyleRenderer
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyCell, decorators: [{
type: Directive,
args: [{
selector: 'ly-cell, td[ly-cell]',
host: {
'role': 'gridcell',
},
providers: [
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$2.CdkColumnDef }, { type: i0.ElementRef }, { type: i1$1.StyleRenderer }] });
/**
* Header row definition for the ly-table.
* Captures the header row's template and other header properties such as the columns to display.
*/
class LyHeaderRowDef extends CdkHeaderRowDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderRowDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyHeaderRowDef, isStandalone: false, selector: "[lyHeaderRowDef]", inputs: { columns: ["lyHeaderRowDef", "columns"], sticky: ["lyHeaderRowDefSticky", "sticky"] }, providers: [{ provide: CdkHeaderRowDef, useExisting: LyHeaderRowDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderRowDef, decorators: [{
type: Directive,
args: [{
selector: '[lyHeaderRowDef]',
providers: [{ provide: CdkHeaderRowDef, useExisting: LyHeaderRowDef }],
inputs: ['columns: lyHeaderRowDef', 'sticky: lyHeaderRowDefSticky'],
standalone: false
}]
}] });
/**
* Footer row definition for the ly-table.
* Captures the footer row's template and other footer properties such as the columns to display.
*/
class LyFooterRowDef extends CdkFooterRowDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterRowDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyFooterRowDef, isStandalone: false, selector: "[lyFooterRowDef]", inputs: { columns: ["lyFooterRowDef", "columns"], sticky: ["lyFooterRowDefSticky", "sticky"] }, providers: [{ provide: CdkFooterRowDef, useExisting: LyFooterRowDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterRowDef, decorators: [{
type: Directive,
args: [{
selector: '[lyFooterRowDef]',
providers: [{ provide: CdkFooterRowDef, useExisting: LyFooterRowDef }],
inputs: ['columns: lyFooterRowDef', 'sticky: lyFooterRowDefSticky'],
standalone: false
}]
}] });
/**
* Data row definition for the ly-table.
* Captures the data row's template and other properties such as the columns to display and
* a when predicate that describes when this row should be used.
*/
class LyRowDef extends CdkRowDef {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRowDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyRowDef, isStandalone: false, selector: "[lyRowDef]", inputs: { columns: ["lyRowDefColumns", "columns"], when: ["lyRowDefWhen", "when"] }, providers: [{ provide: CdkRowDef, useExisting: LyRowDef }], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRowDef, decorators: [{
type: Directive,
args: [{
selector: '[lyRowDef]',
providers: [{ provide: CdkRowDef, useExisting: LyRowDef }],
inputs: ['columns: lyRowDefColumns', 'when: lyRowDefWhen'],
standalone: false
}]
}] });
/** Header template container that contains the cell outlet. Adds the right class and role. */
class LyHeaderRow extends CdkHeaderRow {
constructor(sRenderer) {
super();
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'headerRow');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderRow, deps: [{ token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: LyHeaderRow, isStandalone: false, selector: "ly-header-row, tr[ly-header-row]", host: { attributes: { "role": "row" } }, providers: [
{ provide: CdkHeaderRow, useExisting: LyHeaderRow },
StyleRenderer
], exportAs: ["lyHeaderRow"], usesInheritance: true, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: i1$2.CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyHeaderRow, decorators: [{
type: Component,
args: [{
selector: 'ly-header-row, tr[ly-header-row]',
template: CDK_ROW_TEMPLATE,
host: {
'role': 'row',
},
// See note on CdkTable for explanation on why this uses the default change detection strategy.
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.None,
exportAs: 'lyHeaderRow',
providers: [
{ provide: CdkHeaderRow, useExisting: LyHeaderRow },
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$1.StyleRenderer }] });
/** Footer template container that contains the cell outlet. Adds the right class and role. */
class LyFooterRow extends CdkFooterRow {
constructor(sRenderer) {
super();
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'footerRow');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterRow, deps: [{ token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: LyFooterRow, isStandalone: false, selector: "ly-footer-row, tr[ly-footer-row]", host: { attributes: { "role": "row" } }, providers: [
{ provide: CdkFooterRow, useExisting: LyFooterRow },
StyleRenderer
], exportAs: ["lyFooterRow"], usesInheritance: true, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: i1$2.CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyFooterRow, decorators: [{
type: Component,
args: [{
selector: 'ly-footer-row, tr[ly-footer-row]',
template: CDK_ROW_TEMPLATE,
host: {
'role': 'row',
},
// See note on CdkTable for explanation on why this uses the default change detection strategy.
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.None,
exportAs: 'lyFooterRow',
providers: [
{ provide: CdkFooterRow, useExisting: LyFooterRow },
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$1.StyleRenderer }] });
/** Data row template container that contains the cell outlet. Adds the right class and role. */
class LyRow extends CdkRow {
constructor(sRenderer) {
super();
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES, 'row');
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRow, deps: [{ token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: LyRow, isStandalone: false, selector: "ly-row, tr[ly-row]", host: { attributes: { "role": "row" } }, providers: [
{ provide: CdkRow, useExisting: LyRow },
StyleRenderer
], exportAs: ["lyRow"], usesInheritance: true, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: i1$2.CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyRow, decorators: [{
type: Component,
args: [{
selector: 'ly-row, tr[ly-row]',
template: CDK_ROW_TEMPLATE,
host: {
'role': 'row',
},
// See note on CdkTable for explanation on why this uses the default change detection strategy.
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.None,
exportAs: 'lyRow',
providers: [
{ provide: CdkRow, useExisting: LyRow },
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i1$1.StyleRenderer }] });
/** Row that can be used to display a message when no data is shown in the table. */
class LyNoDataRow extends CdkNoDataRow {
constructor(templateRef, sRenderer) {
super(templateRef);
this.sRenderer = sRenderer;
this.classes = this.sRenderer.renderSheet(STYLES);
this._contentClassName = this.classes.noDataRow;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyNoDataRow, deps: [{ token: i0.TemplateRef }, { token: i1$1.StyleRenderer }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: LyNoDataRow, isStandalone: false, selector: "ng-template[lyNoDataRow]", providers: [
{ provide: CdkNoDataRow, useExisting: LyNoDataRow },
StyleRenderer
], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyNoDataRow, decorators: [{
type: Directive,
args: [{
selector: 'ng-template[lyNoDataRow]',
providers: [
{ provide: CdkNoDataRow, useExisting: LyNoDataRow },
StyleRenderer
],
standalone: false
}]
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i1$1.StyleRenderer }] });
/**
* Column that simply shows text content for the header and row cells. Assumes that the table
* is using the native table implementation (`<table>`).
*
* By default, the name of this column will be the header text and data property accessor.
* The header text can be overridden with the `headerText` input. Cell values can be overridden with
* the `dataAccessor` input. Change the text justification to the start or end using the `justify`
* input.
*/
class LyTextColumn extends CdkTextColumn {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTextColumn, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: LyTextColumn, isStandalone: false, selector: "ly-text-column", usesInheritance: true, ngImport: i0, template: `
<ng-container lyColumnDef>
<th ly-header-cell *lyHeaderCellDef [style.text-align]="justify">
{{headerText}}
</th>
<td ly-cell *lyCellDef="let data" [style.text-align]="justify">
{{dataAccessor(data, name)}}
</td>
</ng-container>
`, isInline: true, dependencies: [{ kind: "directive", type: LyHeaderCellDef, selector: "[lyHeaderCellDef]" }, { kind: "directive", type: LyColumnDef, selector: "[lyColumnDef]", inputs: ["lyColumnDef"] }, { kind: "directive", type: LyCellDef, selector: "[lyCellDef]" }, { kind: "directive", type: LyHeaderCell, selector: "ly-header-cell, th[ly-header-cell]" }, { kind: "directive", type: LyCell, selector: "ly-cell, td[ly-cell]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTextColumn, decorators: [{
type: Component,
args: [{
selector: 'ly-text-column',
template: `
<ng-container lyColumnDef>
<th ly-header-cell *lyHeaderCellDef [style.text-align]="justify">
{{headerText}}
</th>
<td ly-cell *lyCellDef="let data" [style.text-align]="justify">
{{dataAccessor(data, name)}}
</td>
</ng-container>
`,
encapsulation: ViewEncapsulation.None,
// Change detection is intentionally not set to OnPush. This component's template will be provided
// to the table to be inserted into its view. This is problematic when change detection runs since
// the bindings in this template will be evaluated _after_ the table's view is evaluated, which
// mean's the template in the table's view will not have the updated value (and in fact will cause
// an ExpressionChangedAfterItHasBeenCheckedError).
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
standalone: false
}]
}] });
const EXPORTED_DECLARATIONS = [
// Table
LyTable,
LyRecycleRows,
// Template defs
LyHeaderCellDef,
LyHeaderRowDef,
LyColumnDef,
LyCellDef,
LyRowDef,
LyFooterCellDef,
LyFooterRowDef,
// Cell directives
LyHeaderCell,
LyCell,
LyFooterCell,
// Row directives
LyHeaderRow,
LyRow,
LyFooterRow,
LyNoDataRow,
LyTextColumn,
];
class LyTableModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: LyTableModule, declarations: [
// Table
LyTable,
LyRecycleRows,
// Template defs
LyHeaderCellDef,
LyHeaderRowDef,
LyColumnDef,
LyCellDef,
LyRowDef,
LyFooterCellDef,
LyFooterRowDef,
// Cell directives
LyHeaderCell,
LyCell,
LyFooterCell,
// Row directives
LyHeaderRow,
LyRow,
LyFooterRow,
LyNoDataRow,
LyTextColumn], imports: [CdkTableModule, LyCommonModule], exports: [LyCommonModule,
// Table
LyTable,
LyRecycleRows,
// Template defs
LyHeaderCellDef,
LyHeaderRowDef,
LyColumnDef,
LyCellDef,
LyRowDef,
LyFooterCellDef,
LyFooterRowDef,
// Cell directives
LyHeaderCell,
LyCell,
LyFooterCell,
// Row directives
LyHeaderRow,
LyRow,
LyFooterRow,
LyNoDataRow,
LyTextColumn] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTableModule, imports: [CdkTableModule, LyCommonModule, LyCommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: LyTableModule, decorators: [{
type: NgModule,
args: [{
imports: [CdkTableModule, LyCommonModule],
exports: [LyCommonModule, EXPORTED_DECLARATIONS],
declarations: EXPORTED_DECLARATIONS,
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { LyCell, LyCellDef, LyColumnDef, LyFooterCell, LyFooterCellDef, LyFooterRow, LyFooterRowDef, LyHeaderCell, LyHeaderCellDef, LyHeaderRow, LyHeaderRowDef, LyNoDataRow, LyRecycleRows, LyRow, LyRowDef, LyTable, LyTableModule, LyTextColumn, STYLES };
//# sourceMappingURL=alyle-ui-table.mjs.map