@angular/cdk 10.1.1 → 10.2.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/a11y/index.metadata.json +1 -1
- package/a11y/key-manager/list-key-manager.d.ts +4 -3
- package/bundles/cdk-a11y.umd.js +440 -384
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +34 -10
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +40 -40
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js +10 -2
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +25 -25
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.min.js +5 -4
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +37 -36
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +10 -2
- package/bundles/cdk-clipboard.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.js +498 -238
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +6 -4
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +508 -448
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +64 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.js +30 -26
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +7 -6
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +34 -34
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +2 -2
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +492 -435
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +51 -11
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +38 -11
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +5 -12
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +385 -322
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +3 -12
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +503 -490
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +20 -34
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +135 -136
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +11 -2
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +923 -653
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +7 -22
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +310 -245
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -9
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +341 -292
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +6 -29
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +342 -270
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +3 -17
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +53 -53
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +10 -2
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +481 -417
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +28 -3
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- 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/collections/dispose-view-repeater-strategy.d.ts +22 -0
- package/collections/index.metadata.json +1 -1
- package/collections/public-api.d.ts +3 -0
- package/collections/recycle-view-repeater-strategy.d.ts +56 -0
- package/collections/view-repeater.d.ts +94 -0
- package/drag-drop/index.d.ts +1 -2
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/public-api.d.ts +2 -1
- package/esm2015/a11y/aria-describer/aria-describer.js +3 -3
- package/esm2015/a11y/focus-monitor/focus-monitor.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +5 -4
- package/esm2015/a11y/key-manager/list-key-manager.js +8 -6
- package/esm2015/clipboard/pending-copy.js +7 -6
- package/esm2015/collections/collection-viewer.js +1 -0
- package/esm2015/collections/dispose-view-repeater-strategy.js +48 -0
- package/esm2015/collections/public-api.js +4 -1
- package/esm2015/collections/recycle-view-repeater-strategy.js +128 -0
- package/esm2015/collections/selection-model.js +2 -2
- package/esm2015/collections/tree-adapter.js +1 -0
- package/esm2015/collections/view-repeater.js +16 -0
- package/esm2015/drag-drop/clone-node.js +9 -1
- package/esm2015/drag-drop/directives/drag-handle.js +1 -3
- package/esm2015/drag-drop/directives/drag.js +7 -5
- package/esm2015/drag-drop/directives/drop-list.js +3 -3
- package/esm2015/drag-drop/drag-events.js +1 -0
- package/esm2015/drag-drop/drag-ref.js +2 -2
- package/esm2015/drag-drop/index.js +1 -3
- package/esm2015/drag-drop/public-api.js +3 -2
- package/esm2015/layout/breakpoints-observer.js +9 -9
- package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +11 -9
- package/esm2015/overlay/overlay-config.js +1 -5
- package/esm2015/overlay/overlay-directives.js +18 -2
- package/esm2015/overlay/overlay-ref.js +6 -8
- package/esm2015/overlay/overlay-reference.js +1 -0
- package/esm2015/overlay/overlay.js +4 -4
- package/esm2015/overlay/position/connected-position-strategy.js +2 -9
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +19 -16
- package/esm2015/overlay/position/position-strategy.js +1 -0
- package/esm2015/overlay/scroll/close-scroll-strategy.js +2 -2
- package/esm2015/overlay/scroll/reposition-scroll-strategy.js +2 -2
- package/esm2015/platform/features/scrolling.js +29 -2
- package/esm2015/portal/dom-portal-outlet.js +7 -4
- package/esm2015/portal/portal-directives.js +3 -3
- package/esm2015/portal/portal-injector.js +3 -1
- package/esm2015/portal/portal.js +25 -19
- package/esm2015/scrolling/fixed-size-virtual-scroll.js +2 -2
- package/esm2015/scrolling/scrolling-module.js +4 -1
- package/esm2015/scrolling/virtual-for-of.js +67 -92
- package/esm2015/scrolling/virtual-scroll-repeater.js +1 -0
- package/esm2015/scrolling/virtual-scroll-viewport.js +5 -5
- package/esm2015/stepper/stepper.js +19 -17
- package/esm2015/table/cell.js +34 -14
- package/esm2015/table/coalesced-style-scheduler.js +87 -0
- package/esm2015/table/public-api.js +2 -1
- package/esm2015/table/sticky-styler.js +79 -45
- package/esm2015/table/table-module.js +4 -2
- package/esm2015/table/table.js +70 -44
- package/esm2015/table/text-column.js +9 -5
- package/esm2015/testing/element-dimensions.js +1 -0
- package/esm2015/testing/protractor/protractor-element.js +6 -3
- package/esm2015/testing/public-api.js +2 -1
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/task-state-zone-interceptor.js +2 -2
- package/esm2015/testing/testbed/unit-test-element.js +26 -21
- package/esm2015/testing/text-filtering.js +23 -0
- package/esm2015/text-field/autofill.js +3 -3
- package/esm2015/tree/control/tree-control.js +1 -0
- package/esm2015/tree/nested-node.js +2 -2
- package/esm2015/tree/padding.js +34 -20
- package/esm2015/tree/tree.js +14 -27
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +15 -12
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +6 -5
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/collections.js +194 -3
- package/fesm2015/collections.js.map +1 -1
- package/fesm2015/drag-drop.js +32 -23
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/layout.js +8 -8
- package/fesm2015/layout.js.map +1 -1
- package/fesm2015/overlay.js +55 -48
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +28 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/portal.js +34 -23
- package/fesm2015/portal.js.map +1 -1
- package/fesm2015/scrolling.js +72 -95
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/stepper.js +19 -17
- package/fesm2015/stepper.js.map +1 -1
- package/fesm2015/table.js +274 -105
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +5 -2
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +26 -21
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js +24 -1
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/text-field.js +2 -2
- package/fesm2015/text-field.js.map +1 -1
- package/fesm2015/tree.js +46 -45
- package/fesm2015/tree.js.map +1 -1
- package/layout/breakpoints-observer.d.ts +3 -3
- package/overlay/index.metadata.json +1 -1
- package/overlay/overlay-config.d.ts +0 -4
- package/overlay/overlay-directives.d.ts +1 -0
- package/overlay/position/connected-position-strategy.d.ts +1 -3
- package/package.json +1 -1
- package/platform/index.metadata.json +1 -1
- package/portal/index.metadata.json +1 -1
- package/portal/portal-injector.d.ts +2 -0
- package/schematics/index.js +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/data/index.js +1 -1
- package/schematics/ng-update/public-api.js +1 -1
- package/schematics/update-tool/public-api.js +1 -1
- package/schematics/utils/index.js +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scrolling-module.d.ts +3 -0
- package/scrolling/virtual-for-of.d.ts +11 -19
- package/stepper/index.metadata.json +1 -1
- package/stepper/stepper.d.ts +7 -10
- package/table/cell.d.ts +21 -1
- package/table/coalesced-style-scheduler.d.ts +41 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/sticky-styler.d.ts +7 -1
- package/table/table.d.ts +14 -8
- package/testing/protractor/protractor-element.d.ts +2 -2
- package/testing/public-api.d.ts +1 -0
- package/testing/test-element.d.ts +9 -2
- package/testing/testbed/unit-test-element.d.ts +9 -2
- package/testing/text-filtering.d.ts +13 -0
- package/tree/index.metadata.json +1 -1
- package/tree/padding.d.ts +14 -0
- package/tree/tree.d.ts +2 -4
package/fesm2015/table.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Directionality } from '@angular/cdk/bidi';
|
|
2
2
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
3
|
-
import { isDataSource } from '@angular/cdk/collections';
|
|
3
|
+
import { isDataSource, _VIEW_REPEATER_STRATEGY, _DisposeViewRepeaterStrategy } from '@angular/cdk/collections';
|
|
4
4
|
export { DataSource } from '@angular/cdk/collections';
|
|
5
5
|
import { Platform } from '@angular/cdk/platform';
|
|
6
6
|
import { DOCUMENT } from '@angular/common';
|
|
7
|
-
import { InjectionToken, Directive, TemplateRef, Inject, Optional, Input, ContentChild, ElementRef, IterableDiffers, ViewContainerRef, Component, ChangeDetectionStrategy, ViewEncapsulation, EmbeddedViewRef,
|
|
8
|
-
import { Subject, BehaviorSubject, isObservable, of } from 'rxjs';
|
|
9
|
-
import { takeUntil } from 'rxjs/operators';
|
|
7
|
+
import { InjectionToken, Directive, TemplateRef, Inject, Optional, Input, ContentChild, ElementRef, Injectable, NgZone, IterableDiffers, ViewContainerRef, Component, ChangeDetectionStrategy, ViewEncapsulation, EmbeddedViewRef, ChangeDetectorRef, Attribute, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
|
8
|
+
import { Subject, from, BehaviorSubject, isObservable, of } from 'rxjs';
|
|
9
|
+
import { takeUntil, take } from 'rxjs/operators';
|
|
10
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @license
|
|
@@ -132,17 +133,8 @@ class CdkColumnDef extends _CdkColumnDefBase {
|
|
|
132
133
|
this._stickyEnd = false;
|
|
133
134
|
}
|
|
134
135
|
/** Unique name for this column. */
|
|
135
|
-
get name() {
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
set name(name) {
|
|
139
|
-
// If the directive is set without a name (updated programatically), then this setter will
|
|
140
|
-
// trigger with an empty string and should not overwrite the programatically set value.
|
|
141
|
-
if (name) {
|
|
142
|
-
this._name = name;
|
|
143
|
-
this.cssClassFriendlyName = name.replace(/[^a-z0-9_-]/ig, '-');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
136
|
+
get name() { return this._name; }
|
|
137
|
+
set name(name) { this._setNameInput(name); }
|
|
146
138
|
/**
|
|
147
139
|
* Whether this column should be sticky positioned on the end of the row. Should make sure
|
|
148
140
|
* that it mimics the `CanStick` mixin such that `_hasStickyChanged` is set to true if the value
|
|
@@ -156,6 +148,31 @@ class CdkColumnDef extends _CdkColumnDefBase {
|
|
|
156
148
|
this._stickyEnd = coerceBooleanProperty(v);
|
|
157
149
|
this._hasStickyChanged = prevValue !== this._stickyEnd;
|
|
158
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Overridable method that sets the css classes that will be added to every cell in this
|
|
153
|
+
* column.
|
|
154
|
+
* In the future, columnCssClassName will change from type string[] to string and this
|
|
155
|
+
* will set a single string value.
|
|
156
|
+
* @docs-private
|
|
157
|
+
*/
|
|
158
|
+
_updateColumnCssClassName() {
|
|
159
|
+
this._columnCssClassName = [`cdk-column-${this.cssClassFriendlyName}`];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* This has been extracted to a util because of TS 4 and VE.
|
|
163
|
+
* View Engine doesn't support property rename inheritance.
|
|
164
|
+
* TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
|
165
|
+
* @docs-private
|
|
166
|
+
*/
|
|
167
|
+
_setNameInput(value) {
|
|
168
|
+
// If the directive is set without a name (updated programatically), then this setter will
|
|
169
|
+
// trigger with an empty string and should not overwrite the programatically set value.
|
|
170
|
+
if (value) {
|
|
171
|
+
this._name = value;
|
|
172
|
+
this.cssClassFriendlyName = value.replace(/[^a-z0-9_-]/ig, '-');
|
|
173
|
+
this._updateColumnCssClassName();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
159
176
|
}
|
|
160
177
|
CdkColumnDef.decorators = [
|
|
161
178
|
{ type: Directive, args: [{
|
|
@@ -177,8 +194,12 @@ CdkColumnDef.propDecorators = {
|
|
|
177
194
|
/** Base class for the cells. Adds a CSS classname that identifies the column it renders in. */
|
|
178
195
|
class BaseCdkCell {
|
|
179
196
|
constructor(columnDef, elementRef) {
|
|
180
|
-
|
|
181
|
-
|
|
197
|
+
// If IE 11 is dropped before we switch to setting a single class name, change to multi param
|
|
198
|
+
// with destructuring.
|
|
199
|
+
const classList = elementRef.nativeElement.classList;
|
|
200
|
+
for (const className of columnDef._columnCssClassName) {
|
|
201
|
+
classList.add(className);
|
|
202
|
+
}
|
|
182
203
|
}
|
|
183
204
|
}
|
|
184
205
|
/** Header cell template container that adds the right classes and role. */
|
|
@@ -239,6 +260,90 @@ CdkCell.ctorParameters = () => [
|
|
|
239
260
|
{ type: ElementRef }
|
|
240
261
|
];
|
|
241
262
|
|
|
263
|
+
/**
|
|
264
|
+
* @license
|
|
265
|
+
* Copyright Google LLC All Rights Reserved.
|
|
266
|
+
*
|
|
267
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
268
|
+
* found in the LICENSE file at https://angular.io/license
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* @docs-private
|
|
272
|
+
*/
|
|
273
|
+
class _Schedule {
|
|
274
|
+
constructor() {
|
|
275
|
+
this.tasks = [];
|
|
276
|
+
this.endTasks = [];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Allows grouping up CSSDom mutations after the current execution context.
|
|
281
|
+
* This can significantly improve performance when separate consecutive functions are
|
|
282
|
+
* reading from the CSSDom and then mutating it.
|
|
283
|
+
*
|
|
284
|
+
* @docs-private
|
|
285
|
+
*/
|
|
286
|
+
class _CoalescedStyleScheduler {
|
|
287
|
+
constructor(_ngZone) {
|
|
288
|
+
this._ngZone = _ngZone;
|
|
289
|
+
this._currentSchedule = null;
|
|
290
|
+
this._destroyed = new Subject();
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Schedules the specified task to run at the end of the current VM turn.
|
|
294
|
+
*/
|
|
295
|
+
schedule(task) {
|
|
296
|
+
this._createScheduleIfNeeded();
|
|
297
|
+
this._currentSchedule.tasks.push(task);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Schedules the specified task to run after other scheduled tasks at the end of the current
|
|
301
|
+
* VM turn.
|
|
302
|
+
*/
|
|
303
|
+
scheduleEnd(task) {
|
|
304
|
+
this._createScheduleIfNeeded();
|
|
305
|
+
this._currentSchedule.endTasks.push(task);
|
|
306
|
+
}
|
|
307
|
+
/** Prevent any further tasks from running. */
|
|
308
|
+
ngOnDestroy() {
|
|
309
|
+
this._destroyed.next();
|
|
310
|
+
this._destroyed.complete();
|
|
311
|
+
}
|
|
312
|
+
_createScheduleIfNeeded() {
|
|
313
|
+
if (this._currentSchedule) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
this._currentSchedule = new _Schedule();
|
|
317
|
+
this._getScheduleObservable().pipe(takeUntil(this._destroyed)).subscribe(() => {
|
|
318
|
+
while (this._currentSchedule.tasks.length || this._currentSchedule.endTasks.length) {
|
|
319
|
+
const schedule = this._currentSchedule;
|
|
320
|
+
// Capture new tasks scheduled by the current set of tasks.
|
|
321
|
+
this._currentSchedule = new _Schedule();
|
|
322
|
+
for (const task of schedule.tasks) {
|
|
323
|
+
task();
|
|
324
|
+
}
|
|
325
|
+
for (const task of schedule.endTasks) {
|
|
326
|
+
task();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
this._currentSchedule = null;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
_getScheduleObservable() {
|
|
333
|
+
// Use onStable when in the context of an ongoing change detection cycle so that we
|
|
334
|
+
// do not accidentally trigger additional cycles.
|
|
335
|
+
return this._ngZone.isStable ?
|
|
336
|
+
from(Promise.resolve(undefined)) :
|
|
337
|
+
this._ngZone.onStable.pipe(take(1));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_CoalescedStyleScheduler.decorators = [
|
|
341
|
+
{ type: Injectable }
|
|
342
|
+
];
|
|
343
|
+
_CoalescedStyleScheduler.ctorParameters = () => [
|
|
344
|
+
{ type: NgZone }
|
|
345
|
+
];
|
|
346
|
+
|
|
242
347
|
/**
|
|
243
348
|
* @license
|
|
244
349
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -505,12 +610,17 @@ class StickyStyler {
|
|
|
505
610
|
* @param direction The directionality context of the table (ltr/rtl); affects column positioning
|
|
506
611
|
* by reversing left/right positions.
|
|
507
612
|
* @param _isBrowser Whether the table is currently being rendered on the server or the client.
|
|
613
|
+
* @param _needsPositionStickyOnElement Whether we need to specify position: sticky on cells
|
|
614
|
+
* using inline styles. If false, it is assumed that position: sticky is included in
|
|
615
|
+
* the component stylesheet for _stickCellCss.
|
|
508
616
|
*/
|
|
509
|
-
constructor(_isNativeHtmlTable, _stickCellCss, direction, _isBrowser = true) {
|
|
617
|
+
constructor(_isNativeHtmlTable, _stickCellCss, direction, _coalescedStyleScheduler, _isBrowser = true, _needsPositionStickyOnElement = true) {
|
|
510
618
|
this._isNativeHtmlTable = _isNativeHtmlTable;
|
|
511
619
|
this._stickCellCss = _stickCellCss;
|
|
512
620
|
this.direction = direction;
|
|
621
|
+
this._coalescedStyleScheduler = _coalescedStyleScheduler;
|
|
513
622
|
this._isBrowser = _isBrowser;
|
|
623
|
+
this._needsPositionStickyOnElement = _needsPositionStickyOnElement;
|
|
514
624
|
}
|
|
515
625
|
/**
|
|
516
626
|
* Clears the sticky positioning styles from the row and its cells by resetting the `position`
|
|
@@ -519,18 +629,24 @@ class StickyStyler {
|
|
|
519
629
|
* @param stickyDirections The directions that should no longer be set as sticky on the rows.
|
|
520
630
|
*/
|
|
521
631
|
clearStickyPositioning(rows, stickyDirections) {
|
|
632
|
+
const elementsToClear = [];
|
|
522
633
|
for (const row of rows) {
|
|
523
634
|
// If the row isn't an element (e.g. if it's an `ng-container`),
|
|
524
635
|
// it won't have inline styles or `children` so we skip it.
|
|
525
636
|
if (row.nodeType !== row.ELEMENT_NODE) {
|
|
526
637
|
continue;
|
|
527
638
|
}
|
|
528
|
-
|
|
639
|
+
elementsToClear.push(row);
|
|
529
640
|
for (let i = 0; i < row.children.length; i++) {
|
|
530
|
-
|
|
531
|
-
this._removeStickyStyle(cell, stickyDirections);
|
|
641
|
+
elementsToClear.push(row.children[i]);
|
|
532
642
|
}
|
|
533
643
|
}
|
|
644
|
+
// Coalesce with sticky row/column updates (and potentially other changes like column resize).
|
|
645
|
+
this._coalescedStyleScheduler.schedule(() => {
|
|
646
|
+
for (const element of elementsToClear) {
|
|
647
|
+
this._removeStickyStyle(element, stickyDirections);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
534
650
|
}
|
|
535
651
|
/**
|
|
536
652
|
* Applies sticky left and right positions to the cells of each row according to the sticky
|
|
@@ -542,8 +658,8 @@ class StickyStyler {
|
|
|
542
658
|
* in this index position should be stuck to the end of the row.
|
|
543
659
|
*/
|
|
544
660
|
updateStickyColumns(rows, stickyStartStates, stickyEndStates) {
|
|
545
|
-
|
|
546
|
-
|
|
661
|
+
if (!rows.length || !this._isBrowser || !(stickyStartStates.some(state => state) ||
|
|
662
|
+
stickyEndStates.some(state => state))) {
|
|
547
663
|
return;
|
|
548
664
|
}
|
|
549
665
|
const firstRow = rows[0];
|
|
@@ -551,18 +667,23 @@ class StickyStyler {
|
|
|
551
667
|
const cellWidths = this._getCellWidths(firstRow);
|
|
552
668
|
const startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates);
|
|
553
669
|
const endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
670
|
+
// Coalesce with sticky row updates (and potentially other changes like column resize).
|
|
671
|
+
this._coalescedStyleScheduler.schedule(() => {
|
|
672
|
+
const isRtl = this.direction === 'rtl';
|
|
673
|
+
const start = isRtl ? 'right' : 'left';
|
|
674
|
+
const end = isRtl ? 'left' : 'right';
|
|
675
|
+
for (const row of rows) {
|
|
676
|
+
for (let i = 0; i < numCells; i++) {
|
|
677
|
+
const cell = row.children[i];
|
|
678
|
+
if (stickyStartStates[i]) {
|
|
679
|
+
this._addStickyStyle(cell, start, startPositions[i]);
|
|
680
|
+
}
|
|
681
|
+
if (stickyEndStates[i]) {
|
|
682
|
+
this._addStickyStyle(cell, end, endPositions[i]);
|
|
683
|
+
}
|
|
563
684
|
}
|
|
564
685
|
}
|
|
565
|
-
}
|
|
686
|
+
});
|
|
566
687
|
}
|
|
567
688
|
/**
|
|
568
689
|
* Applies sticky positioning to the row's cells if using the native table layout, and to the
|
|
@@ -585,29 +706,34 @@ class StickyStyler {
|
|
|
585
706
|
// sticky states need to be reversed as well.
|
|
586
707
|
const rows = position === 'bottom' ? rowsToStick.slice().reverse() : rowsToStick;
|
|
587
708
|
const states = position === 'bottom' ? stickyStates.slice().reverse() : stickyStates;
|
|
588
|
-
|
|
589
|
-
|
|
709
|
+
// Measure row heights all at once before adding sticky styles to reduce layout thrashing.
|
|
710
|
+
const stickyHeights = [];
|
|
711
|
+
const elementsToStick = [];
|
|
712
|
+
for (let rowIndex = 0, stickyHeight = 0; rowIndex < rows.length; rowIndex++) {
|
|
713
|
+
stickyHeights[rowIndex] = stickyHeight;
|
|
590
714
|
if (!states[rowIndex]) {
|
|
591
715
|
continue;
|
|
592
716
|
}
|
|
593
717
|
const row = rows[rowIndex];
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
718
|
+
elementsToStick[rowIndex] = this._isNativeHtmlTable ?
|
|
719
|
+
Array.from(row.children) : [row];
|
|
720
|
+
if (rowIndex !== rows.length - 1) {
|
|
721
|
+
stickyHeight += row.getBoundingClientRect().height;
|
|
599
722
|
}
|
|
600
|
-
else {
|
|
601
|
-
// Flex does not respect the stick positioning on the cells, needs to be applied to the row.
|
|
602
|
-
// If this is applied on a native table, Safari causes the header to fly in wrong direction.
|
|
603
|
-
this._addStickyStyle(row, position, stickyHeight);
|
|
604
|
-
}
|
|
605
|
-
if (rowIndex === rows.length - 1) {
|
|
606
|
-
// prevent unnecessary reflow from getBoundingClientRect()
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
stickyHeight += row.getBoundingClientRect().height;
|
|
610
723
|
}
|
|
724
|
+
// Coalesce with other sticky row updates (top/bottom), sticky columns updates
|
|
725
|
+
// (and potentially other changes like column resize).
|
|
726
|
+
this._coalescedStyleScheduler.schedule(() => {
|
|
727
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
728
|
+
if (!states[rowIndex]) {
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
const height = stickyHeights[rowIndex];
|
|
732
|
+
for (const element of elementsToStick[rowIndex]) {
|
|
733
|
+
this._addStickyStyle(element, position, height);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
});
|
|
611
737
|
}
|
|
612
738
|
/**
|
|
613
739
|
* When using the native table in Safari, sticky footer cells do not stick. The only way to stick
|
|
@@ -620,12 +746,15 @@ class StickyStyler {
|
|
|
620
746
|
return;
|
|
621
747
|
}
|
|
622
748
|
const tfoot = tableElement.querySelector('tfoot');
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
749
|
+
// Coalesce with other sticky updates (and potentially other changes like column resize).
|
|
750
|
+
this._coalescedStyleScheduler.schedule(() => {
|
|
751
|
+
if (stickyStates.some(state => !state)) {
|
|
752
|
+
this._removeStickyStyle(tfoot, ['bottom']);
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
this._addStickyStyle(tfoot, 'bottom', 0);
|
|
756
|
+
}
|
|
757
|
+
});
|
|
629
758
|
}
|
|
630
759
|
/**
|
|
631
760
|
* Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating
|
|
@@ -636,12 +765,20 @@ class StickyStyler {
|
|
|
636
765
|
for (const dir of stickyDirections) {
|
|
637
766
|
element.style[dir] = '';
|
|
638
767
|
}
|
|
639
|
-
element.style.zIndex = this._getCalculatedZIndex(element);
|
|
640
768
|
// If the element no longer has any more sticky directions, remove sticky positioning and
|
|
641
769
|
// the sticky CSS class.
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
770
|
+
// Short-circuit checking element.style[dir] for stickyDirections as they
|
|
771
|
+
// were already removed above.
|
|
772
|
+
const hasDirection = STICKY_DIRECTIONS.some(dir => stickyDirections.indexOf(dir) === -1 && element.style[dir]);
|
|
773
|
+
if (hasDirection) {
|
|
774
|
+
element.style.zIndex = this._getCalculatedZIndex(element);
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
// When not hasDirection, _getCalculatedZIndex will always return ''.
|
|
778
|
+
element.style.zIndex = '';
|
|
779
|
+
if (this._needsPositionStickyOnElement) {
|
|
780
|
+
element.style.position = '';
|
|
781
|
+
}
|
|
645
782
|
element.classList.remove(this._stickCellCss);
|
|
646
783
|
}
|
|
647
784
|
}
|
|
@@ -653,8 +790,10 @@ class StickyStyler {
|
|
|
653
790
|
_addStickyStyle(element, dir, dirValue) {
|
|
654
791
|
element.classList.add(this._stickCellCss);
|
|
655
792
|
element.style[dir] = `${dirValue}px`;
|
|
656
|
-
element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
|
|
657
793
|
element.style.zIndex = this._getCalculatedZIndex(element);
|
|
794
|
+
if (this._needsPositionStickyOnElement) {
|
|
795
|
+
element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
|
|
796
|
+
}
|
|
658
797
|
}
|
|
659
798
|
/**
|
|
660
799
|
* Calculate what the z-index should be for the element, depending on what directions (top,
|
|
@@ -901,12 +1040,17 @@ class RowViewRef extends EmbeddedViewRef {
|
|
|
901
1040
|
* connect function that will return an Observable stream that emits the data array to render.
|
|
902
1041
|
*/
|
|
903
1042
|
class CdkTable {
|
|
904
|
-
constructor(_differs, _changeDetectorRef, _elementRef, role, _dir, _document, _platform
|
|
1043
|
+
constructor(_differs, _changeDetectorRef, _coalescedStyleScheduler, _elementRef, role, _dir, _document, _platform,
|
|
1044
|
+
// Optional for backwards compatibility, but a view repeater strategy will always
|
|
1045
|
+
// be provided.
|
|
1046
|
+
_viewRepeater) {
|
|
905
1047
|
this._differs = _differs;
|
|
906
1048
|
this._changeDetectorRef = _changeDetectorRef;
|
|
1049
|
+
this._coalescedStyleScheduler = _coalescedStyleScheduler;
|
|
907
1050
|
this._elementRef = _elementRef;
|
|
908
1051
|
this._dir = _dir;
|
|
909
1052
|
this._platform = _platform;
|
|
1053
|
+
this._viewRepeater = _viewRepeater;
|
|
910
1054
|
/** Subject that emits when the component has been destroyed. */
|
|
911
1055
|
this._onDestroy = new Subject();
|
|
912
1056
|
/**
|
|
@@ -968,6 +1112,12 @@ class CdkTable {
|
|
|
968
1112
|
* table subclasses.
|
|
969
1113
|
*/
|
|
970
1114
|
this.stickyCssClass = 'cdk-table-sticky';
|
|
1115
|
+
/**
|
|
1116
|
+
* Whether to manually add positon: sticky to all sticky cell elements. Not needed if
|
|
1117
|
+
* the position is set in a selector associated with the value of stickyCssClass. May be
|
|
1118
|
+
* overridden by table subclasses
|
|
1119
|
+
*/
|
|
1120
|
+
this.needsPositionStickyOnElement = true;
|
|
971
1121
|
/** Whether the no data row is currently showing anything. */
|
|
972
1122
|
this._isShowingNoDataRow = false;
|
|
973
1123
|
this._multiTemplateDataRows = false;
|
|
@@ -996,8 +1146,7 @@ class CdkTable {
|
|
|
996
1146
|
return this._trackByFn;
|
|
997
1147
|
}
|
|
998
1148
|
set trackBy(fn) {
|
|
999
|
-
if (
|
|
1000
|
-
console.warn) {
|
|
1149
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && fn != null && typeof fn !== 'function') {
|
|
1001
1150
|
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}.`);
|
|
1002
1151
|
}
|
|
1003
1152
|
this._trackByFn = fn;
|
|
@@ -1045,6 +1194,7 @@ class CdkTable {
|
|
|
1045
1194
|
// this setter will be invoked before the row outlet has been defined hence the null check.
|
|
1046
1195
|
if (this._rowOutlet && this._rowOutlet.viewContainer.length) {
|
|
1047
1196
|
this._forceRenderDataRows();
|
|
1197
|
+
this.updateStickyColumnStyles();
|
|
1048
1198
|
}
|
|
1049
1199
|
}
|
|
1050
1200
|
ngOnInit() {
|
|
@@ -1064,11 +1214,13 @@ class CdkTable {
|
|
|
1064
1214
|
this._cacheRowDefs();
|
|
1065
1215
|
this._cacheColumnDefs();
|
|
1066
1216
|
// Make sure that the user has at least added header, footer, or data row def.
|
|
1067
|
-
if (!this._headerRowDefs.length && !this._footerRowDefs.length && !this._rowDefs.length
|
|
1217
|
+
if (!this._headerRowDefs.length && !this._footerRowDefs.length && !this._rowDefs.length &&
|
|
1218
|
+
(typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1068
1219
|
throw getTableMissingRowDefsError();
|
|
1069
1220
|
}
|
|
1070
1221
|
// Render updates if the list of columns have been changed for the header, row, or footer defs.
|
|
1071
|
-
this._renderUpdatedColumns();
|
|
1222
|
+
const columnsChanged = this._renderUpdatedColumns();
|
|
1223
|
+
const stickyColumnStyleUpdateNeeded = columnsChanged || this._headerRowDefChanged || this._footerRowDefChanged;
|
|
1072
1224
|
// If the header row definition has been changed, trigger a render to the header row.
|
|
1073
1225
|
if (this._headerRowDefChanged) {
|
|
1074
1226
|
this._forceRenderHeaderRows();
|
|
@@ -1084,6 +1236,11 @@ class CdkTable {
|
|
|
1084
1236
|
if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) {
|
|
1085
1237
|
this._observeRenderChanges();
|
|
1086
1238
|
}
|
|
1239
|
+
else if (stickyColumnStyleUpdateNeeded) {
|
|
1240
|
+
// In the above case, _observeRenderChanges will result in updateStickyColumnStyles being
|
|
1241
|
+
// called when it row data arrives. Otherwise, we need to call it proactively.
|
|
1242
|
+
this.updateStickyColumnStyles();
|
|
1243
|
+
}
|
|
1087
1244
|
this._checkStickyStates();
|
|
1088
1245
|
}
|
|
1089
1246
|
ngOnDestroy() {
|
|
@@ -1116,16 +1273,9 @@ class CdkTable {
|
|
|
1116
1273
|
return;
|
|
1117
1274
|
}
|
|
1118
1275
|
const viewContainer = this._rowOutlet.viewContainer;
|
|
1119
|
-
|
|
1120
|
-
if (
|
|
1121
|
-
this.
|
|
1122
|
-
}
|
|
1123
|
-
else if (currentIndex == null) {
|
|
1124
|
-
viewContainer.remove(prevIndex);
|
|
1125
|
-
}
|
|
1126
|
-
else {
|
|
1127
|
-
const view = viewContainer.get(prevIndex);
|
|
1128
|
-
viewContainer.move(view, currentIndex);
|
|
1276
|
+
this._viewRepeater.applyChanges(changes, viewContainer, (record, adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record.item, currentIndex), (record) => record.item.data, (change) => {
|
|
1277
|
+
if (change.operation === 1 /* INSERTED */ && change.context) {
|
|
1278
|
+
this._renderCellTemplateForItem(change.record.item.rowDef, change.context);
|
|
1129
1279
|
}
|
|
1130
1280
|
});
|
|
1131
1281
|
// Update the meta context of a row's context data (index, count, first, last, ...)
|
|
@@ -1315,7 +1465,8 @@ class CdkTable {
|
|
|
1315
1465
|
this._columnDefsByName.clear();
|
|
1316
1466
|
const columnDefs = mergeArrayAndSet(this._getOwnDefs(this._contentColumnDefs), this._customColumnDefs);
|
|
1317
1467
|
columnDefs.forEach(columnDef => {
|
|
1318
|
-
if (this._columnDefsByName.has(columnDef.name)
|
|
1468
|
+
if (this._columnDefsByName.has(columnDef.name) &&
|
|
1469
|
+
(typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1319
1470
|
throw getTableDuplicateColumnNameError(columnDef.name);
|
|
1320
1471
|
}
|
|
1321
1472
|
this._columnDefsByName.set(columnDef.name, columnDef);
|
|
@@ -1328,7 +1479,8 @@ class CdkTable {
|
|
|
1328
1479
|
this._rowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentRowDefs), this._customRowDefs);
|
|
1329
1480
|
// After all row definitions are determined, find the row definition to be considered default.
|
|
1330
1481
|
const defaultRowDefs = this._rowDefs.filter(def => !def.when);
|
|
1331
|
-
if (!this.multiTemplateDataRows && defaultRowDefs.length > 1
|
|
1482
|
+
if (!this.multiTemplateDataRows && defaultRowDefs.length > 1 &&
|
|
1483
|
+
(typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1332
1484
|
throw getTableMultipleDefaultRowDefsError();
|
|
1333
1485
|
}
|
|
1334
1486
|
this._defaultRowDef = defaultRowDefs[0];
|
|
@@ -1341,16 +1493,20 @@ class CdkTable {
|
|
|
1341
1493
|
_renderUpdatedColumns() {
|
|
1342
1494
|
const columnsDiffReducer = (acc, def) => acc || !!def.getColumnsDiff();
|
|
1343
1495
|
// Force re-render data rows if the list of column definitions have changed.
|
|
1344
|
-
|
|
1496
|
+
const dataColumnsChanged = this._rowDefs.reduce(columnsDiffReducer, false);
|
|
1497
|
+
if (dataColumnsChanged) {
|
|
1345
1498
|
this._forceRenderDataRows();
|
|
1346
1499
|
}
|
|
1347
|
-
// Force re-render header/footer rows if the list of column definitions have changed
|
|
1348
|
-
|
|
1500
|
+
// Force re-render header/footer rows if the list of column definitions have changed.
|
|
1501
|
+
const headerColumnsChanged = this._headerRowDefs.reduce(columnsDiffReducer, false);
|
|
1502
|
+
if (headerColumnsChanged) {
|
|
1349
1503
|
this._forceRenderHeaderRows();
|
|
1350
1504
|
}
|
|
1351
|
-
|
|
1505
|
+
const footerColumnsChanged = this._footerRowDefs.reduce(columnsDiffReducer, false);
|
|
1506
|
+
if (footerColumnsChanged) {
|
|
1352
1507
|
this._forceRenderFooterRows();
|
|
1353
1508
|
}
|
|
1509
|
+
return dataColumnsChanged || headerColumnsChanged || footerColumnsChanged;
|
|
1354
1510
|
}
|
|
1355
1511
|
/**
|
|
1356
1512
|
* Switch to the provided data source by resetting the data and unsubscribing from the current
|
|
@@ -1391,10 +1547,11 @@ class CdkTable {
|
|
|
1391
1547
|
else if (Array.isArray(this.dataSource)) {
|
|
1392
1548
|
dataStream = of(this.dataSource);
|
|
1393
1549
|
}
|
|
1394
|
-
if (dataStream === undefined) {
|
|
1550
|
+
if (dataStream === undefined && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1395
1551
|
throw getTableUnknownDataSourceError();
|
|
1396
1552
|
}
|
|
1397
|
-
this._renderChangeSubscription = dataStream.pipe(takeUntil(this._onDestroy))
|
|
1553
|
+
this._renderChangeSubscription = dataStream.pipe(takeUntil(this._onDestroy))
|
|
1554
|
+
.subscribe(data => {
|
|
1398
1555
|
this._data = data || [];
|
|
1399
1556
|
this.renderRows();
|
|
1400
1557
|
});
|
|
@@ -1410,7 +1567,6 @@ class CdkTable {
|
|
|
1410
1567
|
}
|
|
1411
1568
|
this._headerRowDefs.forEach((def, i) => this._renderRow(this._headerRowOutlet, def, i));
|
|
1412
1569
|
this.updateStickyHeaderRowStyles();
|
|
1413
|
-
this.updateStickyColumnStyles();
|
|
1414
1570
|
}
|
|
1415
1571
|
/**
|
|
1416
1572
|
* Clears any existing content in the footer row outlet and creates a new embedded view
|
|
@@ -1423,13 +1579,12 @@ class CdkTable {
|
|
|
1423
1579
|
}
|
|
1424
1580
|
this._footerRowDefs.forEach((def, i) => this._renderRow(this._footerRowOutlet, def, i));
|
|
1425
1581
|
this.updateStickyFooterRowStyles();
|
|
1426
|
-
this.updateStickyColumnStyles();
|
|
1427
1582
|
}
|
|
1428
1583
|
/** Adds the sticky column styles for the rows according to the columns' stick states. */
|
|
1429
1584
|
_addStickyColumnStyles(rows, rowDef) {
|
|
1430
1585
|
const columnDefs = Array.from(rowDef.columns || []).map(columnName => {
|
|
1431
1586
|
const columnDef = this._columnDefsByName.get(columnName);
|
|
1432
|
-
if (!columnDef) {
|
|
1587
|
+
if (!columnDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1433
1588
|
throw getTableUnknownColumnError(columnName);
|
|
1434
1589
|
}
|
|
1435
1590
|
return columnDef;
|
|
@@ -1467,19 +1622,19 @@ class CdkTable {
|
|
|
1467
1622
|
rowDefs.push(rowDef);
|
|
1468
1623
|
}
|
|
1469
1624
|
}
|
|
1470
|
-
if (!rowDefs.length) {
|
|
1625
|
+
if (!rowDefs.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1471
1626
|
throw getTableMissingMatchingRowDefError(data);
|
|
1472
1627
|
}
|
|
1473
1628
|
return rowDefs;
|
|
1474
1629
|
}
|
|
1475
|
-
|
|
1476
|
-
* Create the embedded view for the data row template and place it in the correct index location
|
|
1477
|
-
* within the data row view container.
|
|
1478
|
-
*/
|
|
1479
|
-
_insertRow(renderRow, renderIndex) {
|
|
1630
|
+
_getEmbeddedViewArgs(renderRow, index) {
|
|
1480
1631
|
const rowDef = renderRow.rowDef;
|
|
1481
1632
|
const context = { $implicit: renderRow.data };
|
|
1482
|
-
|
|
1633
|
+
return {
|
|
1634
|
+
templateRef: rowDef.template,
|
|
1635
|
+
context,
|
|
1636
|
+
index,
|
|
1637
|
+
};
|
|
1483
1638
|
}
|
|
1484
1639
|
/**
|
|
1485
1640
|
* Creates a new row template in the outlet and fills it with the set of cell templates.
|
|
@@ -1488,7 +1643,11 @@ class CdkTable {
|
|
|
1488
1643
|
*/
|
|
1489
1644
|
_renderRow(outlet, rowDef, index, context = {}) {
|
|
1490
1645
|
// TODO(andrewseguin): enforce that one outlet was instantiated from createEmbeddedView
|
|
1491
|
-
outlet.viewContainer.createEmbeddedView(rowDef.template, context, index);
|
|
1646
|
+
const view = outlet.viewContainer.createEmbeddedView(rowDef.template, context, index);
|
|
1647
|
+
this._renderCellTemplateForItem(rowDef, context);
|
|
1648
|
+
return view;
|
|
1649
|
+
}
|
|
1650
|
+
_renderCellTemplateForItem(rowDef, context) {
|
|
1492
1651
|
for (let cellTemplate of this._getCellTemplates(rowDef)) {
|
|
1493
1652
|
if (CdkCellOutlet.mostRecentCellOutlet) {
|
|
1494
1653
|
CdkCellOutlet.mostRecentCellOutlet._viewContainer.createEmbeddedView(cellTemplate, context);
|
|
@@ -1526,7 +1685,7 @@ class CdkTable {
|
|
|
1526
1685
|
}
|
|
1527
1686
|
return Array.from(rowDef.columns, columnId => {
|
|
1528
1687
|
const column = this._columnDefsByName.get(columnId);
|
|
1529
|
-
if (!column) {
|
|
1688
|
+
if (!column && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1530
1689
|
throw getTableUnknownColumnError(columnId);
|
|
1531
1690
|
}
|
|
1532
1691
|
return rowDef.extractCellTemplate(column);
|
|
@@ -1560,7 +1719,6 @@ class CdkTable {
|
|
|
1560
1719
|
this._dataDiffer.diff([]);
|
|
1561
1720
|
this._rowOutlet.viewContainer.clear();
|
|
1562
1721
|
this.renderRows();
|
|
1563
|
-
this.updateStickyColumnStyles();
|
|
1564
1722
|
}
|
|
1565
1723
|
/**
|
|
1566
1724
|
* Checks if there has been a change in sticky states since last check and applies the correct
|
|
@@ -1591,7 +1749,7 @@ class CdkTable {
|
|
|
1591
1749
|
*/
|
|
1592
1750
|
_setupStickyStyler() {
|
|
1593
1751
|
const direction = this._dir ? this._dir.value : 'ltr';
|
|
1594
|
-
this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, this.stickyCssClass, direction, this._platform.isBrowser);
|
|
1752
|
+
this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, this.stickyCssClass, direction, this._coalescedStyleScheduler, this._platform.isBrowser, this.needsPositionStickyOnElement);
|
|
1595
1753
|
(this._dir ? this._dir.change : of())
|
|
1596
1754
|
.pipe(takeUntil(this._onDestroy))
|
|
1597
1755
|
.subscribe(value => {
|
|
@@ -1629,17 +1787,23 @@ CdkTable.decorators = [
|
|
|
1629
1787
|
// declared elsewhere, they are checked when their declaration points are checked.
|
|
1630
1788
|
// tslint:disable-next-line:validate-decorators
|
|
1631
1789
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
1632
|
-
providers: [
|
|
1790
|
+
providers: [
|
|
1791
|
+
{ provide: CDK_TABLE, useExisting: CdkTable },
|
|
1792
|
+
{ provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
|
|
1793
|
+
_CoalescedStyleScheduler,
|
|
1794
|
+
]
|
|
1633
1795
|
},] }
|
|
1634
1796
|
];
|
|
1635
1797
|
CdkTable.ctorParameters = () => [
|
|
1636
1798
|
{ type: IterableDiffers },
|
|
1637
1799
|
{ type: ChangeDetectorRef },
|
|
1800
|
+
{ type: _CoalescedStyleScheduler },
|
|
1638
1801
|
{ type: ElementRef },
|
|
1639
1802
|
{ type: String, decorators: [{ type: Attribute, args: ['role',] }] },
|
|
1640
1803
|
{ type: Directionality, decorators: [{ type: Optional }] },
|
|
1641
1804
|
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
1642
|
-
{ type: Platform }
|
|
1805
|
+
{ type: Platform },
|
|
1806
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [_VIEW_REPEATER_STRATEGY,] }] }
|
|
1643
1807
|
];
|
|
1644
1808
|
CdkTable.propDecorators = {
|
|
1645
1809
|
trackBy: [{ type: Input }],
|
|
@@ -1681,7 +1845,11 @@ function mergeArrayAndSet(array, set) {
|
|
|
1681
1845
|
* input.
|
|
1682
1846
|
*/
|
|
1683
1847
|
class CdkTextColumn {
|
|
1684
|
-
constructor(
|
|
1848
|
+
constructor(
|
|
1849
|
+
// `CdkTextColumn` is always requiring a table, but we just assert it manually
|
|
1850
|
+
// for better error reporting.
|
|
1851
|
+
// tslint:disable-next-line: lightweight-tokens
|
|
1852
|
+
_table, _options) {
|
|
1685
1853
|
this._table = _table;
|
|
1686
1854
|
this._options = _options;
|
|
1687
1855
|
/** Alignment of the cell values. */
|
|
@@ -1715,7 +1883,7 @@ class CdkTextColumn {
|
|
|
1715
1883
|
this.columnDef.headerCell = this.headerCell;
|
|
1716
1884
|
this._table.addColumnDef(this.columnDef);
|
|
1717
1885
|
}
|
|
1718
|
-
else {
|
|
1886
|
+
else if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1719
1887
|
throw getTableTextColumnMissingParentTableError();
|
|
1720
1888
|
}
|
|
1721
1889
|
}
|
|
@@ -1730,7 +1898,7 @@ class CdkTextColumn {
|
|
|
1730
1898
|
*/
|
|
1731
1899
|
_createDefaultHeaderText() {
|
|
1732
1900
|
const name = this.name;
|
|
1733
|
-
if (
|
|
1901
|
+
if (!name && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1734
1902
|
throw getTableTextColumnMissingNameError();
|
|
1735
1903
|
}
|
|
1736
1904
|
if (this._options && this._options.defaultHeaderTextTransform) {
|
|
@@ -1817,7 +1985,8 @@ class CdkTableModule {
|
|
|
1817
1985
|
CdkTableModule.decorators = [
|
|
1818
1986
|
{ type: NgModule, args: [{
|
|
1819
1987
|
exports: EXPORTED_DECLARATIONS,
|
|
1820
|
-
declarations: EXPORTED_DECLARATIONS
|
|
1988
|
+
declarations: EXPORTED_DECLARATIONS,
|
|
1989
|
+
imports: [ScrollingModule]
|
|
1821
1990
|
},] }
|
|
1822
1991
|
];
|
|
1823
1992
|
|
|
@@ -1833,5 +2002,5 @@ CdkTableModule.decorators = [
|
|
|
1833
2002
|
* Generated bundle index. Do not edit.
|
|
1834
2003
|
*/
|
|
1835
2004
|
|
|
1836
|
-
export { BaseCdkCell, BaseRowDef, CDK_ROW_TEMPLATE, CDK_TABLE, CDK_TABLE_TEMPLATE, CdkCell, CdkCellDef, CdkCellOutlet, CdkColumnDef, CdkFooterCell, CdkFooterCellDef, CdkFooterRow, CdkFooterRowDef, CdkHeaderCell, CdkHeaderCellDef, CdkHeaderRow, CdkHeaderRowDef, CdkNoDataRow, CdkRow, CdkRowDef, CdkTable, CdkTableModule, CdkTextColumn, DataRowOutlet, FooterRowOutlet, HeaderRowOutlet, NoDataRowOutlet, STICKY_DIRECTIONS, StickyStyler, TEXT_COLUMN_OPTIONS, mixinHasStickyInput };
|
|
2005
|
+
export { BaseCdkCell, BaseRowDef, CDK_ROW_TEMPLATE, CDK_TABLE, CDK_TABLE_TEMPLATE, CdkCell, CdkCellDef, CdkCellOutlet, CdkColumnDef, CdkFooterCell, CdkFooterCellDef, CdkFooterRow, CdkFooterRowDef, CdkHeaderCell, CdkHeaderCellDef, CdkHeaderRow, CdkHeaderRowDef, CdkNoDataRow, CdkRow, CdkRowDef, CdkTable, CdkTableModule, CdkTextColumn, DataRowOutlet, FooterRowOutlet, HeaderRowOutlet, NoDataRowOutlet, STICKY_DIRECTIONS, StickyStyler, TEXT_COLUMN_OPTIONS, _CoalescedStyleScheduler, _Schedule, mixinHasStickyInput };
|
|
1837
2006
|
//# sourceMappingURL=table.js.map
|