@angular/cdk 8.0.0-beta.2 → 8.0.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.
- package/README.md +2 -2
- package/_overlay.scss +4 -4
- package/bundles/cdk-a11y.umd.js +227 -79
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +20 -8
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +5 -5
- package/bundles/cdk-bidi.umd.min.js +1 -1
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +5 -5
- package/bundles/cdk-collections.umd.js +38 -15
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +571 -180
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -2
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js +7 -3
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-keycodes.umd.min.js.map +1 -1
- package/bundles/cdk-layout.umd.js +83 -30
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +1 -1
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +30 -11
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +229 -108
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +17 -10
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +32 -13
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +184 -62
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +30 -12
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +384 -74
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +61 -21
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +85 -29
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +2 -2
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/typings/directives/drag.d.ts +11 -2
- package/drag-drop/typings/drag-events.d.ts +17 -0
- package/drag-drop/typings/drag-ref.d.ts +9 -5
- package/drag-drop/typings/drop-list-ref.d.ts +9 -3
- package/drag-drop/typings/index.metadata.json +1 -1
- package/esm2015/a11y.js +229 -81
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +22 -10
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/bidi.js +8 -8
- package/esm2015/cdk.js +4 -4
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +7 -7
- package/esm2015/collections.js +41 -18
- package/esm2015/collections.js.map +1 -1
- package/esm2015/drag-drop.js +540 -181
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/keycodes.js +9 -5
- package/esm2015/keycodes.js.map +1 -1
- package/esm2015/layout.js +89 -36
- package/esm2015/layout.js.map +1 -1
- package/esm2015/observers.js +33 -14
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +232 -110
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +20 -13
- package/esm2015/platform.js.map +1 -1
- package/esm2015/portal.js +34 -15
- package/esm2015/portal.js.map +1 -1
- package/esm2015/scrolling.js +180 -58
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +32 -14
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +369 -69
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +64 -24
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js +86 -30
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +230 -82
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +22 -10
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/bidi.es5.js +8 -8
- package/esm5/cdk.es5.js +4 -4
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/coercion.es5.js +7 -7
- package/esm5/collections.es5.js +42 -19
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +574 -183
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/keycodes.es5.js +9 -5
- package/esm5/keycodes.es5.js.map +1 -1
- package/esm5/layout.es5.js +86 -33
- package/esm5/layout.es5.js.map +1 -1
- package/esm5/observers.es5.js +33 -14
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +232 -111
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +20 -13
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/portal.es5.js +34 -15
- package/esm5/portal.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +187 -65
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +32 -14
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +386 -72
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +64 -24
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js +87 -31
- package/esm5/tree.es5.js.map +1 -1
- package/layout/typings/breakpoints-observer.d.ts +3 -3
- package/layout/typings/index.metadata.json +1 -1
- package/layout/typings/media-matcher.d.ts +2 -2
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/position/flexible-connected-position-strategy.d.ts +1 -3
- package/package.json +8 -8
- package/portal/typings/portal.d.ts +2 -2
- package/schematics/ng-update/data/attribute-selectors.js +1 -1
- package/schematics/ng-update/data/attribute-selectors.js.map +1 -1
- package/schematics/ng-update/data/class-names.js +3 -3
- package/schematics/ng-update/data/class-names.js.map +1 -1
- package/schematics/ng-update/data/constructor-checks.js +1 -1
- package/schematics/ng-update/data/constructor-checks.js.map +1 -1
- package/schematics/ng-update/data/input-names.js +1 -1
- package/schematics/ng-update/data/input-names.js.map +1 -1
- package/schematics/ng-update/data/method-call-checks.js +1 -1
- package/schematics/ng-update/data/method-call-checks.js.map +1 -1
- package/schematics/ng-update/data/property-names.js +4 -4
- package/schematics/ng-update/data/property-names.js.map +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js.map +1 -1
- package/schematics/tsconfig.tsbuildinfo +5811 -0
- package/schematics/utils/ast.d.ts +1 -1
- package/schematics/utils/build-component.js +1 -1
- package/schematics/utils/build-component.js.map +1 -1
- package/schematics/utils/get-project.d.ts +1 -1
- package/schematics/utils/project-main-file.d.ts +1 -1
- package/schematics/utils/project-style-file.d.ts +1 -1
- package/schematics/utils/project-targets.d.ts +1 -1
- package/schematics/utils/schematic-options.d.ts +1 -1
- package/table/typings/cell.d.ts +3 -2
- package/table/typings/index.metadata.json +1 -1
- package/table/typings/public-api.d.ts +1 -0
- package/table/typings/row.d.ts +5 -4
- package/table/typings/sticky-styler.d.ts +5 -5
- package/table/typings/table-errors.d.ts +10 -0
- package/table/typings/text-column.d.ts +80 -0
- package/typings/drag-drop/directives/drag.d.ts +11 -2
- package/typings/drag-drop/drag-events.d.ts +17 -0
- package/typings/drag-drop/drag-ref.d.ts +9 -5
- package/typings/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/directives/drag.d.ts +11 -2
- package/typings/esm5/drag-drop/drag-events.d.ts +17 -0
- package/typings/esm5/drag-drop/drag-ref.d.ts +9 -5
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/layout/breakpoints-observer.d.ts +3 -3
- package/typings/esm5/layout/index.metadata.json +1 -1
- package/typings/esm5/layout/media-matcher.d.ts +2 -2
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/esm5/portal/portal.d.ts +2 -2
- package/typings/esm5/table/cell.d.ts +3 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/table/public-api.d.ts +1 -0
- package/typings/esm5/table/row.d.ts +5 -4
- package/typings/esm5/table/sticky-styler.d.ts +5 -5
- package/typings/esm5/table/table-errors.d.ts +10 -0
- package/typings/esm5/table/text-column.d.ts +80 -0
- package/typings/index.metadata.json +1 -1
- package/typings/layout/breakpoints-observer.d.ts +3 -3
- package/typings/layout/index.metadata.json +1 -1
- package/typings/layout/media-matcher.d.ts +2 -2
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/portal/portal.d.ts +2 -2
- package/typings/schematics/utils/ast.d.ts +1 -1
- package/typings/schematics/utils/get-project.d.ts +1 -1
- package/typings/schematics/utils/project-main-file.d.ts +1 -1
- package/typings/schematics/utils/project-style-file.d.ts +1 -1
- package/typings/schematics/utils/project-targets.d.ts +1 -1
- package/typings/schematics/utils/schematic-options.d.ts +1 -1
- package/typings/table/cell.d.ts +3 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/table/public-api.d.ts +1 -0
- package/typings/table/row.d.ts +5 -4
- package/typings/table/sticky-styler.d.ts +5 -5
- package/typings/table/table-errors.d.ts +10 -0
- package/typings/table/text-column.d.ts +80 -0
package/esm2015/table.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
9
|
-
import { ContentChild, Directive, ElementRef, Input, TemplateRef, ChangeDetectionStrategy, Component, IterableDiffers, ViewContainerRef, ViewEncapsulation, Attribute, ChangeDetectorRef, ContentChildren, Inject, isDevMode, Optional, ViewChild, NgModule } from '@angular/core';
|
|
9
|
+
import { ContentChild, Directive, ElementRef, Input, TemplateRef, ChangeDetectionStrategy, Component, IterableDiffers, ViewContainerRef, ViewEncapsulation, Attribute, ChangeDetectorRef, ContentChildren, Inject, isDevMode, Optional, ViewChild, InjectionToken, NgModule } from '@angular/core';
|
|
10
10
|
import { Directionality } from '@angular/cdk/bidi';
|
|
11
11
|
import { isDataSource } from '@angular/cdk/collections';
|
|
12
12
|
export { DataSource } from '@angular/cdk/collections';
|
|
@@ -17,7 +17,7 @@ import { takeUntil } from 'rxjs/operators';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @fileoverview added by tsickle
|
|
20
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
20
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
23
23
|
* Mixin to provide a directive with a function that checks if the sticky input has been
|
|
@@ -78,7 +78,7 @@ function mixinHasStickyInput(base) {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* @fileoverview added by tsickle
|
|
81
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
81
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
82
82
|
*/
|
|
83
83
|
/**
|
|
84
84
|
* Cell definition for a CDK table.
|
|
@@ -158,7 +158,9 @@ class CdkColumnDef extends _CdkColumnDefBase {
|
|
|
158
158
|
* Unique name for this column.
|
|
159
159
|
* @return {?}
|
|
160
160
|
*/
|
|
161
|
-
get name() {
|
|
161
|
+
get name() {
|
|
162
|
+
return this._name;
|
|
163
|
+
}
|
|
162
164
|
/**
|
|
163
165
|
* @param {?} name
|
|
164
166
|
* @return {?}
|
|
@@ -178,7 +180,9 @@ class CdkColumnDef extends _CdkColumnDefBase {
|
|
|
178
180
|
* has been changed.
|
|
179
181
|
* @return {?}
|
|
180
182
|
*/
|
|
181
|
-
get stickyEnd() {
|
|
183
|
+
get stickyEnd() {
|
|
184
|
+
return this._stickyEnd;
|
|
185
|
+
}
|
|
182
186
|
/**
|
|
183
187
|
* @param {?} v
|
|
184
188
|
* @return {?}
|
|
@@ -194,10 +198,7 @@ CdkColumnDef.decorators = [
|
|
|
194
198
|
{ type: Directive, args: [{
|
|
195
199
|
selector: '[cdkColumnDef]',
|
|
196
200
|
inputs: ['sticky'],
|
|
197
|
-
providers: [{
|
|
198
|
-
provide: 'MAT_SORT_HEADER_COLUMN_DEF',
|
|
199
|
-
useExisting: CdkColumnDef
|
|
200
|
-
}],
|
|
201
|
+
providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }],
|
|
201
202
|
},] },
|
|
202
203
|
];
|
|
203
204
|
CdkColumnDef.propDecorators = {
|
|
@@ -302,7 +303,7 @@ CdkCell.ctorParameters = () => [
|
|
|
302
303
|
|
|
303
304
|
/**
|
|
304
305
|
* @fileoverview added by tsickle
|
|
305
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
306
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
306
307
|
*/
|
|
307
308
|
/**
|
|
308
309
|
* The row template that can be used by the mat-table. Should not be used outside of the
|
|
@@ -568,7 +569,7 @@ CdkRow.decorators = [
|
|
|
568
569
|
|
|
569
570
|
/**
|
|
570
571
|
* @fileoverview added by tsickle
|
|
571
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
572
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
572
573
|
*/
|
|
573
574
|
|
|
574
575
|
/**
|
|
@@ -583,17 +584,17 @@ const STICKY_DIRECTIONS = ['top', 'bottom', 'left', 'right'];
|
|
|
583
584
|
*/
|
|
584
585
|
class StickyStyler {
|
|
585
586
|
/**
|
|
586
|
-
* @param {?}
|
|
587
|
+
* @param {?} _isNativeHtmlTable Whether the sticky logic should be based on a table
|
|
587
588
|
* that uses the native `<table>` element.
|
|
588
|
-
* @param {?}
|
|
589
|
+
* @param {?} _stickCellCss The CSS class that will be applied to every row/cell that has
|
|
589
590
|
* sticky positioning applied.
|
|
590
591
|
* @param {?} direction The directionality context of the table (ltr/rtl); affects column positioning
|
|
591
592
|
* by reversing left/right positions.
|
|
592
593
|
* @param {?=} _isBrowser Whether the table is currently being rendered on the server or the client.
|
|
593
594
|
*/
|
|
594
|
-
constructor(
|
|
595
|
-
this.
|
|
596
|
-
this.
|
|
595
|
+
constructor(_isNativeHtmlTable, _stickCellCss, direction, _isBrowser = true) {
|
|
596
|
+
this._isNativeHtmlTable = _isNativeHtmlTable;
|
|
597
|
+
this._stickCellCss = _stickCellCss;
|
|
597
598
|
this.direction = direction;
|
|
598
599
|
this._isBrowser = _isBrowser;
|
|
599
600
|
}
|
|
@@ -631,7 +632,15 @@ class StickyStyler {
|
|
|
631
632
|
*/
|
|
632
633
|
updateStickyColumns(rows, stickyStartStates, stickyEndStates) {
|
|
633
634
|
/** @type {?} */
|
|
634
|
-
const hasStickyColumns = stickyStartStates.some(
|
|
635
|
+
const hasStickyColumns = stickyStartStates.some((/**
|
|
636
|
+
* @param {?} state
|
|
637
|
+
* @return {?}
|
|
638
|
+
*/
|
|
639
|
+
state => state)) || stickyEndStates.some((/**
|
|
640
|
+
* @param {?} state
|
|
641
|
+
* @return {?}
|
|
642
|
+
*/
|
|
643
|
+
state => state));
|
|
635
644
|
if (!rows.length || !hasStickyColumns || !this._isBrowser) {
|
|
636
645
|
return;
|
|
637
646
|
}
|
|
@@ -689,7 +698,7 @@ class StickyStyler {
|
|
|
689
698
|
}
|
|
690
699
|
/** @type {?} */
|
|
691
700
|
const row = rows[rowIndex];
|
|
692
|
-
if (this.
|
|
701
|
+
if (this._isNativeHtmlTable) {
|
|
693
702
|
for (let j = 0; j < row.children.length; j++) {
|
|
694
703
|
/** @type {?} */
|
|
695
704
|
const cell = (/** @type {?} */ (row.children[j]));
|
|
@@ -718,12 +727,16 @@ class StickyStyler {
|
|
|
718
727
|
* @return {?}
|
|
719
728
|
*/
|
|
720
729
|
updateStickyFooterContainer(tableElement, stickyStates) {
|
|
721
|
-
if (!this.
|
|
730
|
+
if (!this._isNativeHtmlTable) {
|
|
722
731
|
return;
|
|
723
732
|
}
|
|
724
733
|
/** @type {?} */
|
|
725
734
|
const tfoot = (/** @type {?} */ (tableElement.querySelector('tfoot')));
|
|
726
|
-
if (stickyStates.some(
|
|
735
|
+
if (stickyStates.some((/**
|
|
736
|
+
* @param {?} state
|
|
737
|
+
* @return {?}
|
|
738
|
+
*/
|
|
739
|
+
state => !state))) {
|
|
727
740
|
this._removeStickyStyle(tfoot, ['bottom']);
|
|
728
741
|
}
|
|
729
742
|
else {
|
|
@@ -746,10 +759,14 @@ class StickyStyler {
|
|
|
746
759
|
// If the element no longer has any more sticky directions, remove sticky positioning and
|
|
747
760
|
// the sticky CSS class.
|
|
748
761
|
/** @type {?} */
|
|
749
|
-
const hasDirection = STICKY_DIRECTIONS.some(
|
|
762
|
+
const hasDirection = STICKY_DIRECTIONS.some((/**
|
|
763
|
+
* @param {?} dir
|
|
764
|
+
* @return {?}
|
|
765
|
+
*/
|
|
766
|
+
dir => !!element.style[dir]));
|
|
750
767
|
if (!hasDirection) {
|
|
751
768
|
element.style.position = '';
|
|
752
|
-
element.classList.remove(this.
|
|
769
|
+
element.classList.remove(this._stickCellCss);
|
|
753
770
|
}
|
|
754
771
|
}
|
|
755
772
|
/**
|
|
@@ -762,7 +779,7 @@ class StickyStyler {
|
|
|
762
779
|
* @return {?}
|
|
763
780
|
*/
|
|
764
781
|
_addStickyStyle(element, dir, dirValue) {
|
|
765
|
-
element.classList.add(this.
|
|
782
|
+
element.classList.add(this._stickCellCss);
|
|
766
783
|
element.style[dir] = `${dirValue}px`;
|
|
767
784
|
element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
|
|
768
785
|
element.style.zIndex = this._getCalculatedZIndex(element);
|
|
@@ -860,7 +877,7 @@ class StickyStyler {
|
|
|
860
877
|
|
|
861
878
|
/**
|
|
862
879
|
* @fileoverview added by tsickle
|
|
863
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
880
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
864
881
|
*/
|
|
865
882
|
|
|
866
883
|
/**
|
|
@@ -916,10 +933,26 @@ function getTableMissingRowDefsError() {
|
|
|
916
933
|
function getTableUnknownDataSourceError() {
|
|
917
934
|
return Error(`Provided data source did not match an array, Observable, or DataSource`);
|
|
918
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Returns an error to be thrown when the text column cannot find a parent table to inject.
|
|
938
|
+
* \@docs-private
|
|
939
|
+
* @return {?}
|
|
940
|
+
*/
|
|
941
|
+
function getTableTextColumnMissingParentTableError() {
|
|
942
|
+
return Error(`Text column could not find a parent table for registration.`);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Returns an error to be thrown when a table text column doesn't have a name.
|
|
946
|
+
* \@docs-private
|
|
947
|
+
* @return {?}
|
|
948
|
+
*/
|
|
949
|
+
function getTableTextColumnMissingNameError() {
|
|
950
|
+
return Error(`Table text column must have a name.`);
|
|
951
|
+
}
|
|
919
952
|
|
|
920
953
|
/**
|
|
921
954
|
* @fileoverview added by tsickle
|
|
922
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
955
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
923
956
|
*/
|
|
924
957
|
/**
|
|
925
958
|
* Provides a handle for the table to grab the view container's ng-container to insert data rows.
|
|
@@ -1174,7 +1207,9 @@ class CdkTable {
|
|
|
1174
1207
|
*/
|
|
1175
1208
|
set multiTemplateDataRows(v) {
|
|
1176
1209
|
this._multiTemplateDataRows = coerceBooleanProperty(v);
|
|
1177
|
-
if (
|
|
1210
|
+
// In Ivy if this value is set via a static attribute (e.g. <table multiTemplateDataRows>),
|
|
1211
|
+
// this setter will be invoked before the row outlet has been defined hence the null check.
|
|
1212
|
+
if (this._rowOutlet && this._rowOutlet.viewContainer.length) {
|
|
1178
1213
|
this._forceRenderDataRows();
|
|
1179
1214
|
}
|
|
1180
1215
|
}
|
|
@@ -1189,9 +1224,14 @@ class CdkTable {
|
|
|
1189
1224
|
// Set up the trackBy function so that it uses the `RenderRow` as its identity by default. If
|
|
1190
1225
|
// the user has provided a custom trackBy, return the result of that function as evaluated
|
|
1191
1226
|
// with the values of the `RenderRow`'s data and index.
|
|
1192
|
-
this._dataDiffer = this._differs.find([]).create((
|
|
1227
|
+
this._dataDiffer = this._differs.find([]).create((/**
|
|
1228
|
+
* @param {?} _i
|
|
1229
|
+
* @param {?} dataRow
|
|
1230
|
+
* @return {?}
|
|
1231
|
+
*/
|
|
1232
|
+
(_i, dataRow) => {
|
|
1193
1233
|
return this.trackBy ? this.trackBy(dataRow.dataIndex, dataRow.data) : dataRow;
|
|
1194
|
-
});
|
|
1234
|
+
}));
|
|
1195
1235
|
}
|
|
1196
1236
|
/**
|
|
1197
1237
|
* @return {?}
|
|
@@ -1257,7 +1297,13 @@ class CdkTable {
|
|
|
1257
1297
|
}
|
|
1258
1298
|
/** @type {?} */
|
|
1259
1299
|
const viewContainer = this._rowOutlet.viewContainer;
|
|
1260
|
-
changes.forEachOperation((
|
|
1300
|
+
changes.forEachOperation((/**
|
|
1301
|
+
* @param {?} record
|
|
1302
|
+
* @param {?} prevIndex
|
|
1303
|
+
* @param {?} currentIndex
|
|
1304
|
+
* @return {?}
|
|
1305
|
+
*/
|
|
1306
|
+
(record, prevIndex, currentIndex) => {
|
|
1261
1307
|
if (record.previousIndex == null) {
|
|
1262
1308
|
this._insertRow(record.item, (/** @type {?} */ (currentIndex)));
|
|
1263
1309
|
}
|
|
@@ -1269,16 +1315,20 @@ class CdkTable {
|
|
|
1269
1315
|
const view = (/** @type {?} */ (viewContainer.get((/** @type {?} */ (prevIndex)))));
|
|
1270
1316
|
viewContainer.move((/** @type {?} */ (view)), currentIndex);
|
|
1271
1317
|
}
|
|
1272
|
-
});
|
|
1318
|
+
}));
|
|
1273
1319
|
// Update the meta context of a row's context data (index, count, first, last, ...)
|
|
1274
1320
|
this._updateRowIndexContext();
|
|
1275
1321
|
// Update rows that did not get added/removed/moved but may have had their identity changed,
|
|
1276
1322
|
// e.g. if trackBy matched data on some property but the actual data reference changed.
|
|
1277
|
-
changes.forEachIdentityChange((
|
|
1323
|
+
changes.forEachIdentityChange((/**
|
|
1324
|
+
* @param {?} record
|
|
1325
|
+
* @return {?}
|
|
1326
|
+
*/
|
|
1327
|
+
(record) => {
|
|
1278
1328
|
/** @type {?} */
|
|
1279
1329
|
const rowView = (/** @type {?} */ (viewContainer.get((/** @type {?} */ (record.currentIndex)))));
|
|
1280
1330
|
rowView.context.$implicit = record.item.data;
|
|
1281
|
-
});
|
|
1331
|
+
}));
|
|
1282
1332
|
this.updateStickyColumnStyles();
|
|
1283
1333
|
}
|
|
1284
1334
|
/**
|
|
@@ -1399,11 +1449,19 @@ class CdkTable {
|
|
|
1399
1449
|
thead.style.display = headerRows.length ? '' : 'none';
|
|
1400
1450
|
}
|
|
1401
1451
|
/** @type {?} */
|
|
1402
|
-
const stickyStates = this._headerRowDefs.map(
|
|
1452
|
+
const stickyStates = this._headerRowDefs.map((/**
|
|
1453
|
+
* @param {?} def
|
|
1454
|
+
* @return {?}
|
|
1455
|
+
*/
|
|
1456
|
+
def => def.sticky));
|
|
1403
1457
|
this._stickyStyler.clearStickyPositioning(headerRows, ['top']);
|
|
1404
1458
|
this._stickyStyler.stickRows(headerRows, stickyStates, 'top');
|
|
1405
1459
|
// Reset the dirty state of the sticky input change since it has been used.
|
|
1406
|
-
this._headerRowDefs.forEach(
|
|
1460
|
+
this._headerRowDefs.forEach((/**
|
|
1461
|
+
* @param {?} def
|
|
1462
|
+
* @return {?}
|
|
1463
|
+
*/
|
|
1464
|
+
def => def.resetStickyChanged()));
|
|
1407
1465
|
}
|
|
1408
1466
|
/**
|
|
1409
1467
|
* Updates the footer sticky styles. First resets all applied styles with respect to the cells
|
|
@@ -1427,12 +1485,20 @@ class CdkTable {
|
|
|
1427
1485
|
tfoot.style.display = footerRows.length ? '' : 'none';
|
|
1428
1486
|
}
|
|
1429
1487
|
/** @type {?} */
|
|
1430
|
-
const stickyStates = this._footerRowDefs.map(
|
|
1488
|
+
const stickyStates = this._footerRowDefs.map((/**
|
|
1489
|
+
* @param {?} def
|
|
1490
|
+
* @return {?}
|
|
1491
|
+
*/
|
|
1492
|
+
def => def.sticky));
|
|
1431
1493
|
this._stickyStyler.clearStickyPositioning(footerRows, ['bottom']);
|
|
1432
1494
|
this._stickyStyler.stickRows(footerRows, stickyStates, 'bottom');
|
|
1433
1495
|
this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement, stickyStates);
|
|
1434
1496
|
// Reset the dirty state of the sticky input change since it has been used.
|
|
1435
|
-
this._footerRowDefs.forEach(
|
|
1497
|
+
this._footerRowDefs.forEach((/**
|
|
1498
|
+
* @param {?} def
|
|
1499
|
+
* @return {?}
|
|
1500
|
+
*/
|
|
1501
|
+
def => def.resetStickyChanged()));
|
|
1436
1502
|
}
|
|
1437
1503
|
/**
|
|
1438
1504
|
* Updates the column sticky styles. First resets all applied styles with respect to the cells
|
|
@@ -1453,11 +1519,20 @@ class CdkTable {
|
|
|
1453
1519
|
// sticky columns span across all table sections (header, data, footer)
|
|
1454
1520
|
this._stickyStyler.clearStickyPositioning([...headerRows, ...dataRows, ...footerRows], ['left', 'right']);
|
|
1455
1521
|
// Update the sticky styles for each header row depending on the def's sticky state
|
|
1456
|
-
headerRows.forEach((
|
|
1522
|
+
headerRows.forEach((/**
|
|
1523
|
+
* @param {?} headerRow
|
|
1524
|
+
* @param {?} i
|
|
1525
|
+
* @return {?}
|
|
1526
|
+
*/
|
|
1527
|
+
(headerRow, i) => {
|
|
1457
1528
|
this._addStickyColumnStyles([headerRow], this._headerRowDefs[i]);
|
|
1458
|
-
});
|
|
1529
|
+
}));
|
|
1459
1530
|
// Update the sticky styles for each data row depending on its def's sticky state
|
|
1460
|
-
this._rowDefs.forEach(
|
|
1531
|
+
this._rowDefs.forEach((/**
|
|
1532
|
+
* @param {?} rowDef
|
|
1533
|
+
* @return {?}
|
|
1534
|
+
*/
|
|
1535
|
+
rowDef => {
|
|
1461
1536
|
// Collect all the rows rendered with this row definition.
|
|
1462
1537
|
/** @type {?} */
|
|
1463
1538
|
const rows = [];
|
|
@@ -1467,13 +1542,22 @@ class CdkTable {
|
|
|
1467
1542
|
}
|
|
1468
1543
|
}
|
|
1469
1544
|
this._addStickyColumnStyles(rows, rowDef);
|
|
1470
|
-
});
|
|
1545
|
+
}));
|
|
1471
1546
|
// Update the sticky styles for each footer row depending on the def's sticky state
|
|
1472
|
-
footerRows.forEach((
|
|
1547
|
+
footerRows.forEach((/**
|
|
1548
|
+
* @param {?} footerRow
|
|
1549
|
+
* @param {?} i
|
|
1550
|
+
* @return {?}
|
|
1551
|
+
*/
|
|
1552
|
+
(footerRow, i) => {
|
|
1473
1553
|
this._addStickyColumnStyles([footerRow], this._footerRowDefs[i]);
|
|
1474
|
-
});
|
|
1554
|
+
}));
|
|
1475
1555
|
// Reset the dirty state of the sticky input change since it has been used.
|
|
1476
|
-
Array.from(this._columnDefsByName.values()).forEach(
|
|
1556
|
+
Array.from(this._columnDefsByName.values()).forEach((/**
|
|
1557
|
+
* @param {?} def
|
|
1558
|
+
* @return {?}
|
|
1559
|
+
*/
|
|
1560
|
+
def => def.resetStickyChanged()));
|
|
1477
1561
|
}
|
|
1478
1562
|
/**
|
|
1479
1563
|
* Get the list of RenderRow objects to render according to the current list of data and defined
|
|
@@ -1529,7 +1613,11 @@ class CdkTable {
|
|
|
1529
1613
|
_getRenderRowsForData(data, dataIndex, cache) {
|
|
1530
1614
|
/** @type {?} */
|
|
1531
1615
|
const rowDefs = this._getRowDefs(data, dataIndex);
|
|
1532
|
-
return rowDefs.map(
|
|
1616
|
+
return rowDefs.map((/**
|
|
1617
|
+
* @param {?} rowDef
|
|
1618
|
+
* @return {?}
|
|
1619
|
+
*/
|
|
1620
|
+
rowDef => {
|
|
1533
1621
|
/** @type {?} */
|
|
1534
1622
|
const cachedRenderRows = (cache && cache.has(rowDef)) ? (/** @type {?} */ (cache.get(rowDef))) : [];
|
|
1535
1623
|
if (cachedRenderRows.length) {
|
|
@@ -1541,7 +1629,7 @@ class CdkTable {
|
|
|
1541
1629
|
else {
|
|
1542
1630
|
return { data, rowDef, dataIndex };
|
|
1543
1631
|
}
|
|
1544
|
-
});
|
|
1632
|
+
}));
|
|
1545
1633
|
}
|
|
1546
1634
|
/**
|
|
1547
1635
|
* Update the map containing the content's column definitions.
|
|
@@ -1552,12 +1640,16 @@ class CdkTable {
|
|
|
1552
1640
|
this._columnDefsByName.clear();
|
|
1553
1641
|
/** @type {?} */
|
|
1554
1642
|
const columnDefs = mergeQueryListAndSet(this._contentColumnDefs, this._customColumnDefs);
|
|
1555
|
-
columnDefs.forEach(
|
|
1643
|
+
columnDefs.forEach((/**
|
|
1644
|
+
* @param {?} columnDef
|
|
1645
|
+
* @return {?}
|
|
1646
|
+
*/
|
|
1647
|
+
columnDef => {
|
|
1556
1648
|
if (this._columnDefsByName.has(columnDef.name)) {
|
|
1557
1649
|
throw getTableDuplicateColumnNameError(columnDef.name);
|
|
1558
1650
|
}
|
|
1559
1651
|
this._columnDefsByName.set(columnDef.name, columnDef);
|
|
1560
|
-
});
|
|
1652
|
+
}));
|
|
1561
1653
|
}
|
|
1562
1654
|
/**
|
|
1563
1655
|
* Update the list of all available row definitions that can be used.
|
|
@@ -1572,7 +1664,11 @@ class CdkTable {
|
|
|
1572
1664
|
this._rowDefs = mergeQueryListAndSet(this._contentRowDefs, this._customRowDefs);
|
|
1573
1665
|
// After all row definitions are determined, find the row definition to be considered default.
|
|
1574
1666
|
/** @type {?} */
|
|
1575
|
-
const defaultRowDefs = this._rowDefs.filter(
|
|
1667
|
+
const defaultRowDefs = this._rowDefs.filter((/**
|
|
1668
|
+
* @param {?} def
|
|
1669
|
+
* @return {?}
|
|
1670
|
+
*/
|
|
1671
|
+
def => !def.when));
|
|
1576
1672
|
if (!this.multiTemplateDataRows && defaultRowDefs.length > 1) {
|
|
1577
1673
|
throw getTableMultipleDefaultRowDefsError();
|
|
1578
1674
|
}
|
|
@@ -1587,7 +1683,12 @@ class CdkTable {
|
|
|
1587
1683
|
*/
|
|
1588
1684
|
_renderUpdatedColumns() {
|
|
1589
1685
|
/** @type {?} */
|
|
1590
|
-
const columnsDiffReducer = (
|
|
1686
|
+
const columnsDiffReducer = (/**
|
|
1687
|
+
* @param {?} acc
|
|
1688
|
+
* @param {?} def
|
|
1689
|
+
* @return {?}
|
|
1690
|
+
*/
|
|
1691
|
+
(acc, def) => acc || !!def.getColumnsDiff());
|
|
1591
1692
|
// Force re-render data rows if the list of column definitions have changed.
|
|
1592
1693
|
if (this._rowDefs.reduce(columnsDiffReducer, false)) {
|
|
1593
1694
|
this._forceRenderDataRows();
|
|
@@ -1650,10 +1751,14 @@ class CdkTable {
|
|
|
1650
1751
|
if (dataStream === undefined) {
|
|
1651
1752
|
throw getTableUnknownDataSourceError();
|
|
1652
1753
|
}
|
|
1653
|
-
this._renderChangeSubscription = dataStream.pipe(takeUntil(this._onDestroy)).subscribe(
|
|
1754
|
+
this._renderChangeSubscription = dataStream.pipe(takeUntil(this._onDestroy)).subscribe((/**
|
|
1755
|
+
* @param {?} data
|
|
1756
|
+
* @return {?}
|
|
1757
|
+
*/
|
|
1758
|
+
data => {
|
|
1654
1759
|
this._data = data || [];
|
|
1655
1760
|
this.renderRows();
|
|
1656
|
-
});
|
|
1761
|
+
}));
|
|
1657
1762
|
}
|
|
1658
1763
|
/**
|
|
1659
1764
|
* Clears any existing content in the header row outlet and creates a new embedded view
|
|
@@ -1666,7 +1771,12 @@ class CdkTable {
|
|
|
1666
1771
|
if (this._headerRowOutlet.viewContainer.length > 0) {
|
|
1667
1772
|
this._headerRowOutlet.viewContainer.clear();
|
|
1668
1773
|
}
|
|
1669
|
-
this._headerRowDefs.forEach((
|
|
1774
|
+
this._headerRowDefs.forEach((/**
|
|
1775
|
+
* @param {?} def
|
|
1776
|
+
* @param {?} i
|
|
1777
|
+
* @return {?}
|
|
1778
|
+
*/
|
|
1779
|
+
(def, i) => this._renderRow(this._headerRowOutlet, def, i)));
|
|
1670
1780
|
this.updateStickyHeaderRowStyles();
|
|
1671
1781
|
this.updateStickyColumnStyles();
|
|
1672
1782
|
}
|
|
@@ -1681,7 +1791,12 @@ class CdkTable {
|
|
|
1681
1791
|
if (this._footerRowOutlet.viewContainer.length > 0) {
|
|
1682
1792
|
this._footerRowOutlet.viewContainer.clear();
|
|
1683
1793
|
}
|
|
1684
|
-
this._footerRowDefs.forEach((
|
|
1794
|
+
this._footerRowDefs.forEach((/**
|
|
1795
|
+
* @param {?} def
|
|
1796
|
+
* @param {?} i
|
|
1797
|
+
* @return {?}
|
|
1798
|
+
*/
|
|
1799
|
+
(def, i) => this._renderRow(this._footerRowOutlet, def, i)));
|
|
1685
1800
|
this.updateStickyFooterRowStyles();
|
|
1686
1801
|
this.updateStickyColumnStyles();
|
|
1687
1802
|
}
|
|
@@ -1694,18 +1809,30 @@ class CdkTable {
|
|
|
1694
1809
|
*/
|
|
1695
1810
|
_addStickyColumnStyles(rows, rowDef) {
|
|
1696
1811
|
/** @type {?} */
|
|
1697
|
-
const columnDefs = Array.from(rowDef.columns || []).map(
|
|
1812
|
+
const columnDefs = Array.from(rowDef.columns || []).map((/**
|
|
1813
|
+
* @param {?} columnName
|
|
1814
|
+
* @return {?}
|
|
1815
|
+
*/
|
|
1816
|
+
columnName => {
|
|
1698
1817
|
/** @type {?} */
|
|
1699
1818
|
const columnDef = this._columnDefsByName.get(columnName);
|
|
1700
1819
|
if (!columnDef) {
|
|
1701
1820
|
throw getTableUnknownColumnError(columnName);
|
|
1702
1821
|
}
|
|
1703
1822
|
return (/** @type {?} */ (columnDef));
|
|
1704
|
-
});
|
|
1823
|
+
}));
|
|
1705
1824
|
/** @type {?} */
|
|
1706
|
-
const stickyStartStates = columnDefs.map(
|
|
1825
|
+
const stickyStartStates = columnDefs.map((/**
|
|
1826
|
+
* @param {?} columnDef
|
|
1827
|
+
* @return {?}
|
|
1828
|
+
*/
|
|
1829
|
+
columnDef => columnDef.sticky));
|
|
1707
1830
|
/** @type {?} */
|
|
1708
|
-
const stickyEndStates = columnDefs.map(
|
|
1831
|
+
const stickyEndStates = columnDefs.map((/**
|
|
1832
|
+
* @param {?} columnDef
|
|
1833
|
+
* @return {?}
|
|
1834
|
+
*/
|
|
1835
|
+
columnDef => columnDef.stickyEnd));
|
|
1709
1836
|
this._stickyStyler.updateStickyColumns(rows, stickyStartStates, stickyEndStates);
|
|
1710
1837
|
}
|
|
1711
1838
|
/**
|
|
@@ -1739,11 +1866,19 @@ class CdkTable {
|
|
|
1739
1866
|
/** @type {?} */
|
|
1740
1867
|
let rowDefs = [];
|
|
1741
1868
|
if (this.multiTemplateDataRows) {
|
|
1742
|
-
rowDefs = this._rowDefs.filter(
|
|
1869
|
+
rowDefs = this._rowDefs.filter((/**
|
|
1870
|
+
* @param {?} def
|
|
1871
|
+
* @return {?}
|
|
1872
|
+
*/
|
|
1873
|
+
def => !def.when || def.when(dataIndex, data)));
|
|
1743
1874
|
}
|
|
1744
1875
|
else {
|
|
1745
1876
|
/** @type {?} */
|
|
1746
|
-
let rowDef = this._rowDefs.find(
|
|
1877
|
+
let rowDef = this._rowDefs.find((/**
|
|
1878
|
+
* @param {?} def
|
|
1879
|
+
* @return {?}
|
|
1880
|
+
*/
|
|
1881
|
+
def => def.when && def.when(dataIndex, data))) || this._defaultRowDef;
|
|
1747
1882
|
if (rowDef) {
|
|
1748
1883
|
rowDefs.push(rowDef);
|
|
1749
1884
|
}
|
|
@@ -1827,14 +1962,18 @@ class CdkTable {
|
|
|
1827
1962
|
if (!rowDef || !rowDef.columns) {
|
|
1828
1963
|
return [];
|
|
1829
1964
|
}
|
|
1830
|
-
return Array.from(rowDef.columns,
|
|
1965
|
+
return Array.from(rowDef.columns, (/**
|
|
1966
|
+
* @param {?} columnId
|
|
1967
|
+
* @return {?}
|
|
1968
|
+
*/
|
|
1969
|
+
columnId => {
|
|
1831
1970
|
/** @type {?} */
|
|
1832
1971
|
const column = this._columnDefsByName.get(columnId);
|
|
1833
1972
|
if (!column) {
|
|
1834
1973
|
throw getTableUnknownColumnError(columnId);
|
|
1835
1974
|
}
|
|
1836
1975
|
return rowDef.extractCellTemplate(column);
|
|
1837
|
-
});
|
|
1976
|
+
}));
|
|
1838
1977
|
}
|
|
1839
1978
|
/**
|
|
1840
1979
|
* Adds native table sections (e.g. tbody) and moves the row outlets into them.
|
|
@@ -1882,9 +2021,14 @@ class CdkTable {
|
|
|
1882
2021
|
*/
|
|
1883
2022
|
_checkStickyStates() {
|
|
1884
2023
|
/** @type {?} */
|
|
1885
|
-
const stickyCheckReducer = (
|
|
2024
|
+
const stickyCheckReducer = (/**
|
|
2025
|
+
* @param {?} acc
|
|
2026
|
+
* @param {?} d
|
|
2027
|
+
* @return {?}
|
|
2028
|
+
*/
|
|
2029
|
+
(acc, d) => {
|
|
1886
2030
|
return acc || d.hasStickyChanged();
|
|
1887
|
-
};
|
|
2031
|
+
});
|
|
1888
2032
|
// Note that the check needs to occur for every definition since it notifies the definition
|
|
1889
2033
|
// that it can reset its dirty state. Using another operator like `some` may short-circuit
|
|
1890
2034
|
// remaining definitions and leave them in an unchecked state.
|
|
@@ -1911,10 +2055,14 @@ class CdkTable {
|
|
|
1911
2055
|
this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, this.stickyCssClass, direction, this._platform.isBrowser);
|
|
1912
2056
|
(this._dir ? this._dir.change : of())
|
|
1913
2057
|
.pipe(takeUntil(this._onDestroy))
|
|
1914
|
-
.subscribe(
|
|
2058
|
+
.subscribe((/**
|
|
2059
|
+
* @param {?} value
|
|
2060
|
+
* @return {?}
|
|
2061
|
+
*/
|
|
2062
|
+
value => {
|
|
1915
2063
|
this._stickyStyler.direction = value;
|
|
1916
2064
|
this.updateStickyColumnStyles();
|
|
1917
|
-
});
|
|
2065
|
+
}));
|
|
1918
2066
|
}
|
|
1919
2067
|
}
|
|
1920
2068
|
CdkTable.decorators = [
|
|
@@ -1967,7 +2115,158 @@ function mergeQueryListAndSet(queryList, set) {
|
|
|
1967
2115
|
|
|
1968
2116
|
/**
|
|
1969
2117
|
* @fileoverview added by tsickle
|
|
1970
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2118
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2119
|
+
*/
|
|
2120
|
+
/**
|
|
2121
|
+
* Injection token that can be used to specify the text column options.
|
|
2122
|
+
* @type {?}
|
|
2123
|
+
*/
|
|
2124
|
+
const TEXT_COLUMN_OPTIONS = new InjectionToken('text-column-options');
|
|
2125
|
+
/**
|
|
2126
|
+
* Column that simply shows text content for the header and row cells. Assumes that the table
|
|
2127
|
+
* is using the native table implementation (`<table>`).
|
|
2128
|
+
*
|
|
2129
|
+
* By default, the name of this column will be the header text and data property accessor.
|
|
2130
|
+
* The header text can be overridden with the `headerText` input. Cell values can be overridden with
|
|
2131
|
+
* the `dataAccessor` input. Change the text justification to the start or end using the `justify`
|
|
2132
|
+
* input.
|
|
2133
|
+
* @template T
|
|
2134
|
+
*/
|
|
2135
|
+
class CdkTextColumn {
|
|
2136
|
+
/**
|
|
2137
|
+
* @param {?} _table
|
|
2138
|
+
* @param {?} _options
|
|
2139
|
+
*/
|
|
2140
|
+
constructor(_table, _options) {
|
|
2141
|
+
this._table = _table;
|
|
2142
|
+
this._options = _options;
|
|
2143
|
+
/**
|
|
2144
|
+
* Alignment of the cell values.
|
|
2145
|
+
*/
|
|
2146
|
+
this.justify = 'start';
|
|
2147
|
+
this._options = _options || {};
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Column name that should be used to reference this column.
|
|
2151
|
+
* @return {?}
|
|
2152
|
+
*/
|
|
2153
|
+
get name() {
|
|
2154
|
+
return this._name;
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* @param {?} name
|
|
2158
|
+
* @return {?}
|
|
2159
|
+
*/
|
|
2160
|
+
set name(name) {
|
|
2161
|
+
this._name = name;
|
|
2162
|
+
// With Ivy, inputs can be initialized before static query results are
|
|
2163
|
+
// available. In that case, we defer the synchronization until "ngOnInit" fires.
|
|
2164
|
+
this._syncColumnDefName();
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* @return {?}
|
|
2168
|
+
*/
|
|
2169
|
+
ngOnInit() {
|
|
2170
|
+
this._syncColumnDefName();
|
|
2171
|
+
if (this.headerText === undefined) {
|
|
2172
|
+
this.headerText = this._createDefaultHeaderText();
|
|
2173
|
+
}
|
|
2174
|
+
if (!this.dataAccessor) {
|
|
2175
|
+
this.dataAccessor =
|
|
2176
|
+
this._options.defaultDataAccessor || ((/**
|
|
2177
|
+
* @param {?} data
|
|
2178
|
+
* @param {?} name
|
|
2179
|
+
* @return {?}
|
|
2180
|
+
*/
|
|
2181
|
+
(data, name) => ((/** @type {?} */ (data)))[name]));
|
|
2182
|
+
}
|
|
2183
|
+
if (this._table) {
|
|
2184
|
+
// Provide the cell and headerCell directly to the table with the static `ViewChild` query,
|
|
2185
|
+
// since the columnDef will not pick up its content by the time the table finishes checking
|
|
2186
|
+
// its content and initializing the rows.
|
|
2187
|
+
this.columnDef.cell = this.cell;
|
|
2188
|
+
this.columnDef.headerCell = this.headerCell;
|
|
2189
|
+
this._table.addColumnDef(this.columnDef);
|
|
2190
|
+
}
|
|
2191
|
+
else {
|
|
2192
|
+
throw getTableTextColumnMissingParentTableError();
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* @return {?}
|
|
2197
|
+
*/
|
|
2198
|
+
ngOnDestroy() {
|
|
2199
|
+
if (this._table) {
|
|
2200
|
+
this._table.removeColumnDef(this.columnDef);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Creates a default header text. Use the options' header text transformation function if one
|
|
2205
|
+
* has been provided. Otherwise simply capitalize the column name.
|
|
2206
|
+
* @return {?}
|
|
2207
|
+
*/
|
|
2208
|
+
_createDefaultHeaderText() {
|
|
2209
|
+
/** @type {?} */
|
|
2210
|
+
const name = this.name;
|
|
2211
|
+
if (isDevMode() && !name) {
|
|
2212
|
+
throw getTableTextColumnMissingNameError();
|
|
2213
|
+
}
|
|
2214
|
+
if (this._options && this._options.defaultHeaderTextTransform) {
|
|
2215
|
+
return this._options.defaultHeaderTextTransform(name);
|
|
2216
|
+
}
|
|
2217
|
+
return name[0].toUpperCase() + name.slice(1);
|
|
2218
|
+
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Synchronizes the column definition name with the text column name.
|
|
2221
|
+
* @private
|
|
2222
|
+
* @return {?}
|
|
2223
|
+
*/
|
|
2224
|
+
_syncColumnDefName() {
|
|
2225
|
+
if (this.columnDef) {
|
|
2226
|
+
this.columnDef.name = this.name;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
CdkTextColumn.decorators = [
|
|
2231
|
+
{ type: Component, args: [{selector: 'cdk-text-column',
|
|
2232
|
+
template: `
|
|
2233
|
+
<ng-container cdkColumnDef>
|
|
2234
|
+
<th cdk-header-cell *cdkHeaderCellDef [style.text-align]="justify">
|
|
2235
|
+
{{headerText}}
|
|
2236
|
+
</th>
|
|
2237
|
+
<td cdk-cell *cdkCellDef="let data" [style.text-align]="justify">
|
|
2238
|
+
{{dataAccessor(data, name)}}
|
|
2239
|
+
</td>
|
|
2240
|
+
</ng-container>
|
|
2241
|
+
`,
|
|
2242
|
+
encapsulation: ViewEncapsulation.None,
|
|
2243
|
+
// Change detection is intentionally not set to OnPush. This component's template will be provided
|
|
2244
|
+
// to the table to be inserted into its view. This is problematic when change detection runs since
|
|
2245
|
+
// the bindings in this template will be evaluated _after_ the table's view is evaluated, which
|
|
2246
|
+
// mean's the template in the table's view will not have the updated value (and in fact will cause
|
|
2247
|
+
// an ExpressionChangedAfterItHasBeenCheckedError).
|
|
2248
|
+
// tslint:disable-next-line:validate-decorators
|
|
2249
|
+
changeDetection: ChangeDetectionStrategy.Default,
|
|
2250
|
+
},] },
|
|
2251
|
+
];
|
|
2252
|
+
/** @nocollapse */
|
|
2253
|
+
CdkTextColumn.ctorParameters = () => [
|
|
2254
|
+
{ type: CdkTable, decorators: [{ type: Optional }] },
|
|
2255
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TEXT_COLUMN_OPTIONS,] }] }
|
|
2256
|
+
];
|
|
2257
|
+
CdkTextColumn.propDecorators = {
|
|
2258
|
+
name: [{ type: Input }],
|
|
2259
|
+
headerText: [{ type: Input }],
|
|
2260
|
+
dataAccessor: [{ type: Input }],
|
|
2261
|
+
justify: [{ type: Input }],
|
|
2262
|
+
columnDef: [{ type: ViewChild, args: [CdkColumnDef, { static: true },] }],
|
|
2263
|
+
cell: [{ type: ViewChild, args: [CdkCellDef, { static: true },] }],
|
|
2264
|
+
headerCell: [{ type: ViewChild, args: [CdkHeaderCellDef, { static: true },] }]
|
|
2265
|
+
};
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* @fileoverview added by tsickle
|
|
2269
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1971
2270
|
*/
|
|
1972
2271
|
/** @type {?} */
|
|
1973
2272
|
const EXPORTED_DECLARATIONS = [
|
|
@@ -1989,6 +2288,7 @@ const EXPORTED_DECLARATIONS = [
|
|
|
1989
2288
|
DataRowOutlet,
|
|
1990
2289
|
HeaderRowOutlet,
|
|
1991
2290
|
FooterRowOutlet,
|
|
2291
|
+
CdkTextColumn,
|
|
1992
2292
|
];
|
|
1993
2293
|
class CdkTableModule {
|
|
1994
2294
|
}
|
|
@@ -2002,13 +2302,13 @@ CdkTableModule.decorators = [
|
|
|
2002
2302
|
|
|
2003
2303
|
/**
|
|
2004
2304
|
* @fileoverview added by tsickle
|
|
2005
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2305
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2006
2306
|
*/
|
|
2007
2307
|
|
|
2008
2308
|
/**
|
|
2009
2309
|
* @fileoverview added by tsickle
|
|
2010
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2310
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2011
2311
|
*/
|
|
2012
2312
|
|
|
2013
|
-
export { DataRowOutlet, HeaderRowOutlet, FooterRowOutlet, CDK_TABLE_TEMPLATE, CdkTable, CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef,
|
|
2313
|
+
export { DataRowOutlet, HeaderRowOutlet, FooterRowOutlet, CDK_TABLE_TEMPLATE, CdkTable, CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, BaseCdkCell, CdkHeaderCell, CdkFooterCell, CdkCell, CDK_ROW_TEMPLATE, BaseRowDef, CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef, CdkCellOutlet, CdkHeaderRow, CdkFooterRow, CdkRow, CdkTableModule, STICKY_DIRECTIONS, StickyStyler, mixinHasStickyInput, TEXT_COLUMN_OPTIONS, CdkTextColumn };
|
|
2014
2314
|
//# sourceMappingURL=table.js.map
|