@angular/cdk 17.2.1 → 17.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/drag-drop/index.d.ts +19 -14
  2. package/esm2022/dialog/dialog-container.mjs +1 -1
  3. package/esm2022/drag-drop/directives/drag-handle.mjs +5 -3
  4. package/esm2022/drag-drop/directives/drag-placeholder.mjs +8 -2
  5. package/esm2022/drag-drop/directives/drag-preview.mjs +8 -2
  6. package/esm2022/drag-drop/directives/drag.mjs +43 -27
  7. package/esm2022/drag-drop/drag-parent.mjs +1 -1
  8. package/esm2022/menu/context-menu-trigger.mjs +4 -4
  9. package/esm2022/menu/menu-trigger.mjs +4 -4
  10. package/esm2022/overlay/position/flexible-connected-position-strategy.mjs +2 -2
  11. package/esm2022/portal/portal-directives.mjs +7 -5
  12. package/esm2022/scrolling/virtual-scroll-viewport.mjs +1 -1
  13. package/esm2022/table/can-stick.mjs +3 -1
  14. package/esm2022/table/cell.mjs +28 -11
  15. package/esm2022/table/row.mjs +64 -22
  16. package/esm2022/table/table.mjs +1 -1
  17. package/esm2022/table/text-column.mjs +1 -1
  18. package/esm2022/tree/node.mjs +2 -2
  19. package/esm2022/version.mjs +1 -1
  20. package/fesm2022/cdk.mjs +1 -1
  21. package/fesm2022/cdk.mjs.map +1 -1
  22. package/fesm2022/dialog.mjs.map +1 -1
  23. package/fesm2022/drag-drop.mjs +118 -88
  24. package/fesm2022/drag-drop.mjs.map +1 -1
  25. package/fesm2022/menu.mjs +6 -6
  26. package/fesm2022/menu.mjs.map +1 -1
  27. package/fesm2022/overlay.mjs +1 -1
  28. package/fesm2022/overlay.mjs.map +1 -1
  29. package/fesm2022/portal.mjs +6 -4
  30. package/fesm2022/portal.mjs.map +1 -1
  31. package/fesm2022/scrolling.mjs.map +1 -1
  32. package/fesm2022/table.mjs +128 -65
  33. package/fesm2022/table.mjs.map +1 -1
  34. package/fesm2022/tree.mjs +1 -1
  35. package/fesm2022/tree.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/schematics/ng-add/index.js +1 -1
  38. package/schematics/ng-add/index.mjs +1 -1
  39. package/table/index.d.ts +36 -24
@@ -11,42 +11,6 @@ import { Subject, from, BehaviorSubject, isObservable, of } from 'rxjs';
11
11
  import { takeUntil, take } from 'rxjs/operators';
12
12
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
13
13
 
14
- /**
15
- * Mixin to provide a directive with a function that checks if the sticky input has been
16
- * changed since the last time the function was called. Essentially adds a dirty-check to the
17
- * sticky value.
18
- * @docs-private
19
- */
20
- function mixinHasStickyInput(base) {
21
- return class extends base {
22
- /** Whether sticky positioning should be applied. */
23
- get sticky() {
24
- return this._sticky;
25
- }
26
- set sticky(v) {
27
- const prevValue = this._sticky;
28
- this._sticky = coerceBooleanProperty(v);
29
- this._hasStickyChanged = prevValue !== this._sticky;
30
- }
31
- /** Whether the sticky value has changed since this was last called. */
32
- hasStickyChanged() {
33
- const hasStickyChanged = this._hasStickyChanged;
34
- this._hasStickyChanged = false;
35
- return hasStickyChanged;
36
- }
37
- /** Resets the dirty check for cases where the sticky state has been used without checking. */
38
- resetStickyChanged() {
39
- this._hasStickyChanged = false;
40
- }
41
- constructor(...args) {
42
- super(...args);
43
- this._sticky = false;
44
- /** Whether the sticky input has changed since it was last checked. */
45
- this._hasStickyChanged = false;
46
- }
47
- };
48
- }
49
-
50
14
  /**
51
15
  * Used to provide a table to some of the sub-components without causing a circular dependency.
52
16
  * @docs-private
@@ -109,16 +73,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
109
73
  standalone: true,
110
74
  }]
111
75
  }], ctorParameters: () => [{ type: i0.TemplateRef }] });
112
- // Boilerplate for applying mixins to CdkColumnDef.
113
- /** @docs-private */
114
- class CdkColumnDefBase {
115
- }
116
- const _CdkColumnDefBase = mixinHasStickyInput(CdkColumnDefBase);
117
76
  /**
118
77
  * Column definition for the CDK table.
119
78
  * Defines a set of cells available for a table column.
120
79
  */
121
- class CdkColumnDef extends _CdkColumnDefBase {
80
+ class CdkColumnDef {
122
81
  /** Unique name for this column. */
123
82
  get name() {
124
83
  return this._name;
@@ -126,6 +85,16 @@ class CdkColumnDef extends _CdkColumnDefBase {
126
85
  set name(name) {
127
86
  this._setNameInput(name);
128
87
  }
88
+ /** Whether the cell is sticky. */
89
+ get sticky() {
90
+ return this._sticky;
91
+ }
92
+ set sticky(value) {
93
+ if (value !== this._sticky) {
94
+ this._sticky = value;
95
+ this._hasStickyChanged = true;
96
+ }
97
+ }
129
98
  /**
130
99
  * Whether this column should be sticky positioned on the end of the row. Should make sure
131
100
  * that it mimics the `CanStick` mixin such that `_hasStickyChanged` is set to true if the value
@@ -141,10 +110,21 @@ class CdkColumnDef extends _CdkColumnDefBase {
141
110
  }
142
111
  }
143
112
  constructor(_table) {
144
- super();
145
113
  this._table = _table;
114
+ this._hasStickyChanged = false;
115
+ this._sticky = false;
146
116
  this._stickyEnd = false;
147
117
  }
118
+ /** Whether the sticky state has changed. */
119
+ hasStickyChanged() {
120
+ const hasStickyChanged = this._hasStickyChanged;
121
+ this.resetStickyChanged();
122
+ return hasStickyChanged;
123
+ }
124
+ /** Resets the sticky changed state. */
125
+ resetStickyChanged() {
126
+ this._hasStickyChanged = false;
127
+ }
148
128
  /**
149
129
  * Overridable method that sets the css classes that will be added to every cell in this
150
130
  * column.
@@ -171,13 +151,12 @@ class CdkColumnDef extends _CdkColumnDefBase {
171
151
  }
172
152
  }
173
153
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkColumnDef, deps: [{ token: CDK_TABLE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
174
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0", type: CdkColumnDef, isStandalone: true, selector: "[cdkColumnDef]", inputs: { sticky: "sticky", name: ["cdkColumnDef", "name"], stickyEnd: ["stickyEnd", "stickyEnd", booleanAttribute] }, providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }], queries: [{ propertyName: "cell", first: true, predicate: CdkCellDef, descendants: true }, { propertyName: "headerCell", first: true, predicate: CdkHeaderCellDef, descendants: true }, { propertyName: "footerCell", first: true, predicate: CdkFooterCellDef, descendants: true }], usesInheritance: true, ngImport: i0 }); }
154
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0", type: CdkColumnDef, isStandalone: true, selector: "[cdkColumnDef]", inputs: { name: ["cdkColumnDef", "name"], sticky: ["sticky", "sticky", booleanAttribute], stickyEnd: ["stickyEnd", "stickyEnd", booleanAttribute] }, providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }], queries: [{ propertyName: "cell", first: true, predicate: CdkCellDef, descendants: true }, { propertyName: "headerCell", first: true, predicate: CdkHeaderCellDef, descendants: true }, { propertyName: "footerCell", first: true, predicate: CdkFooterCellDef, descendants: true }], ngImport: i0 }); }
175
155
  }
176
156
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkColumnDef, decorators: [{
177
157
  type: Directive,
178
158
  args: [{
179
159
  selector: '[cdkColumnDef]',
180
- inputs: ['sticky'],
181
160
  providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }],
182
161
  standalone: true,
183
162
  }]
@@ -189,6 +168,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
189
168
  }] }], propDecorators: { name: [{
190
169
  type: Input,
191
170
  args: ['cdkColumnDef']
171
+ }], sticky: [{
172
+ type: Input,
173
+ args: [{ transform: booleanAttribute }]
192
174
  }], stickyEnd: [{
193
175
  type: Input,
194
176
  args: [{ transform: booleanAttribute }]
@@ -401,33 +383,50 @@ class BaseRowDef {
401
383
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: BaseRowDef, decorators: [{
402
384
  type: Directive
403
385
  }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.IterableDiffers }] });
404
- // Boilerplate for applying mixins to CdkHeaderRowDef.
405
- /** @docs-private */
406
- class CdkHeaderRowDefBase extends BaseRowDef {
407
- }
408
- const _CdkHeaderRowDefBase = mixinHasStickyInput(CdkHeaderRowDefBase);
409
386
  /**
410
387
  * Header row definition for the CDK table.
411
388
  * Captures the header row's template and other header properties such as the columns to display.
412
389
  */
413
- class CdkHeaderRowDef extends _CdkHeaderRowDefBase {
390
+ class CdkHeaderRowDef extends BaseRowDef {
391
+ /** Whether the row is sticky. */
392
+ get sticky() {
393
+ return this._sticky;
394
+ }
395
+ set sticky(value) {
396
+ if (value !== this._sticky) {
397
+ this._sticky = value;
398
+ this._hasStickyChanged = true;
399
+ }
400
+ }
414
401
  constructor(template, _differs, _table) {
415
402
  super(template, _differs);
416
403
  this._table = _table;
404
+ this._hasStickyChanged = false;
405
+ this._sticky = false;
417
406
  }
418
407
  // Prerender fails to recognize that ngOnChanges in a part of this class through inheritance.
419
408
  // Explicitly define it so that the method is called as part of the Angular lifecycle.
420
409
  ngOnChanges(changes) {
421
410
  super.ngOnChanges(changes);
422
411
  }
412
+ /** Whether the sticky state has changed. */
413
+ hasStickyChanged() {
414
+ const hasStickyChanged = this._hasStickyChanged;
415
+ this.resetStickyChanged();
416
+ return hasStickyChanged;
417
+ }
418
+ /** Resets the sticky changed state. */
419
+ resetStickyChanged() {
420
+ this._hasStickyChanged = false;
421
+ }
423
422
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkHeaderRowDef, deps: [{ token: i0.TemplateRef }, { token: i0.IterableDiffers }, { token: CDK_TABLE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
424
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: CdkHeaderRowDef, isStandalone: true, selector: "[cdkHeaderRowDef]", inputs: { columns: ["cdkHeaderRowDef", "columns"], sticky: ["cdkHeaderRowDefSticky", "sticky"] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
423
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0", type: CdkHeaderRowDef, isStandalone: true, selector: "[cdkHeaderRowDef]", inputs: { columns: ["cdkHeaderRowDef", "columns"], sticky: ["cdkHeaderRowDefSticky", "sticky", booleanAttribute] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
425
424
  }
426
425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkHeaderRowDef, decorators: [{
427
426
  type: Directive,
428
427
  args: [{
429
428
  selector: '[cdkHeaderRowDef]',
430
- inputs: ['columns: cdkHeaderRowDef', 'sticky: cdkHeaderRowDefSticky'],
429
+ inputs: [{ name: 'columns', alias: 'cdkHeaderRowDef' }],
431
430
  standalone: true,
432
431
  }]
433
432
  }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.IterableDiffers }, { type: undefined, decorators: [{
@@ -435,34 +434,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
435
434
  args: [CDK_TABLE]
436
435
  }, {
437
436
  type: Optional
438
- }] }] });
439
- // Boilerplate for applying mixins to CdkFooterRowDef.
440
- /** @docs-private */
441
- class CdkFooterRowDefBase extends BaseRowDef {
442
- }
443
- const _CdkFooterRowDefBase = mixinHasStickyInput(CdkFooterRowDefBase);
437
+ }] }], propDecorators: { sticky: [{
438
+ type: Input,
439
+ args: [{ alias: 'cdkHeaderRowDefSticky', transform: booleanAttribute }]
440
+ }] } });
444
441
  /**
445
442
  * Footer row definition for the CDK table.
446
443
  * Captures the footer row's template and other footer properties such as the columns to display.
447
444
  */
448
- class CdkFooterRowDef extends _CdkFooterRowDefBase {
445
+ class CdkFooterRowDef extends BaseRowDef {
446
+ /** Whether the row is sticky. */
447
+ get sticky() {
448
+ return this._sticky;
449
+ }
450
+ set sticky(value) {
451
+ if (value !== this._sticky) {
452
+ this._sticky = value;
453
+ this._hasStickyChanged = true;
454
+ }
455
+ }
449
456
  constructor(template, _differs, _table) {
450
457
  super(template, _differs);
451
458
  this._table = _table;
459
+ this._hasStickyChanged = false;
460
+ this._sticky = false;
452
461
  }
453
462
  // Prerender fails to recognize that ngOnChanges in a part of this class through inheritance.
454
463
  // Explicitly define it so that the method is called as part of the Angular lifecycle.
455
464
  ngOnChanges(changes) {
456
465
  super.ngOnChanges(changes);
457
466
  }
467
+ /** Whether the sticky state has changed. */
468
+ hasStickyChanged() {
469
+ const hasStickyChanged = this._hasStickyChanged;
470
+ this.resetStickyChanged();
471
+ return hasStickyChanged;
472
+ }
473
+ /** Resets the sticky changed state. */
474
+ resetStickyChanged() {
475
+ this._hasStickyChanged = false;
476
+ }
458
477
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkFooterRowDef, deps: [{ token: i0.TemplateRef }, { token: i0.IterableDiffers }, { token: CDK_TABLE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
459
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.0", type: CdkFooterRowDef, isStandalone: true, selector: "[cdkFooterRowDef]", inputs: { columns: ["cdkFooterRowDef", "columns"], sticky: ["cdkFooterRowDefSticky", "sticky"] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
478
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.2.0", type: CdkFooterRowDef, isStandalone: true, selector: "[cdkFooterRowDef]", inputs: { columns: ["cdkFooterRowDef", "columns"], sticky: ["cdkFooterRowDefSticky", "sticky", booleanAttribute] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
460
479
  }
461
480
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkFooterRowDef, decorators: [{
462
481
  type: Directive,
463
482
  args: [{
464
483
  selector: '[cdkFooterRowDef]',
465
- inputs: ['columns: cdkFooterRowDef', 'sticky: cdkFooterRowDefSticky'],
484
+ inputs: [{ name: 'columns', alias: 'cdkFooterRowDef' }],
466
485
  standalone: true,
467
486
  }]
468
487
  }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.IterableDiffers }, { type: undefined, decorators: [{
@@ -470,7 +489,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
470
489
  args: [CDK_TABLE]
471
490
  }, {
472
491
  type: Optional
473
- }] }] });
492
+ }] }], propDecorators: { sticky: [{
493
+ type: Input,
494
+ args: [{ alias: 'cdkFooterRowDefSticky', transform: booleanAttribute }]
495
+ }] } });
474
496
  /**
475
497
  * Data row definition for the CDK table.
476
498
  * Captures the header row's template and other row properties such as the columns to display and
@@ -490,7 +512,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
490
512
  type: Directive,
491
513
  args: [{
492
514
  selector: '[cdkRowDef]',
493
- inputs: ['columns: cdkRowDefColumns', 'when: cdkRowDefWhen'],
515
+ inputs: [
516
+ { name: 'columns', alias: 'cdkRowDefColumns' },
517
+ { name: 'when', alias: 'cdkRowDefWhen' },
518
+ ],
494
519
  standalone: true,
495
520
  }]
496
521
  }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.IterableDiffers }, { type: undefined, decorators: [{
@@ -2234,7 +2259,7 @@ class CdkTextColumn {
2234
2259
  {{dataAccessor(data, name)}}
2235
2260
  </td>
2236
2261
  </ng-container>
2237
- `, isInline: true, dependencies: [{ kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["sticky", "cdkColumnDef", "stickyEnd"] }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
2262
+ `, isInline: true, dependencies: [{ kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
2238
2263
  }
2239
2264
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: CdkTextColumn, decorators: [{
2240
2265
  type: Component,
@@ -2366,6 +2391,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
2366
2391
  }]
2367
2392
  }] });
2368
2393
 
2394
+ /**
2395
+ * Mixin to provide a directive with a function that checks if the sticky input has been
2396
+ * changed since the last time the function was called. Essentially adds a dirty-check to the
2397
+ * sticky value.
2398
+ * @docs-private
2399
+ * @deprecated Implement the `CanStick` interface instead.
2400
+ * @breaking-change 19.0.0
2401
+ */
2402
+ function mixinHasStickyInput(base) {
2403
+ return class extends base {
2404
+ /** Whether sticky positioning should be applied. */
2405
+ get sticky() {
2406
+ return this._sticky;
2407
+ }
2408
+ set sticky(v) {
2409
+ const prevValue = this._sticky;
2410
+ this._sticky = coerceBooleanProperty(v);
2411
+ this._hasStickyChanged = prevValue !== this._sticky;
2412
+ }
2413
+ /** Whether the sticky value has changed since this was last called. */
2414
+ hasStickyChanged() {
2415
+ const hasStickyChanged = this._hasStickyChanged;
2416
+ this._hasStickyChanged = false;
2417
+ return hasStickyChanged;
2418
+ }
2419
+ /** Resets the dirty check for cases where the sticky state has been used without checking. */
2420
+ resetStickyChanged() {
2421
+ this._hasStickyChanged = false;
2422
+ }
2423
+ constructor(...args) {
2424
+ super(...args);
2425
+ this._sticky = false;
2426
+ /** Whether the sticky input has changed since it was last checked. */
2427
+ this._hasStickyChanged = false;
2428
+ }
2429
+ };
2430
+ }
2431
+
2369
2432
  /**
2370
2433
  * Generated bundle index. Do not edit.
2371
2434
  */