@angular/cdk 21.0.0-next.8 → 21.0.0-rc.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.
Files changed (124) hide show
  1. package/_adev_assets/cdk_drag_drop.json +13 -12
  2. package/_adev_assets/cdk_testing.json +15 -25
  3. package/_adev_assets/cdk_testing_protractor.json +1 -1
  4. package/_adev_assets/cdk_testing_selenium_webdriver.json +1 -1
  5. package/_adev_assets/cdk_testing_testbed.json +1 -1
  6. package/fesm2022/_a11y-module-chunk.mjs +755 -869
  7. package/fesm2022/_a11y-module-chunk.mjs.map +1 -1
  8. package/fesm2022/_activedescendant-key-manager-chunk.mjs +8 -8
  9. package/fesm2022/_activedescendant-key-manager-chunk.mjs.map +1 -1
  10. package/fesm2022/_array-chunk.mjs +1 -1
  11. package/fesm2022/_array-chunk.mjs.map +1 -1
  12. package/fesm2022/_breakpoints-observer-chunk.mjs +149 -152
  13. package/fesm2022/_breakpoints-observer-chunk.mjs.map +1 -1
  14. package/fesm2022/_css-pixel-value-chunk.mjs +4 -5
  15. package/fesm2022/_css-pixel-value-chunk.mjs.map +1 -1
  16. package/fesm2022/_data-source-chunk.mjs +2 -8
  17. package/fesm2022/_data-source-chunk.mjs.map +1 -1
  18. package/fesm2022/_directionality-chunk.mjs +54 -54
  19. package/fesm2022/_directionality-chunk.mjs.map +1 -1
  20. package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs +25 -36
  21. package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs.map +1 -1
  22. package/fesm2022/_element-chunk.mjs +6 -17
  23. package/fesm2022/_element-chunk.mjs.map +1 -1
  24. package/fesm2022/_fake-event-detection-chunk.mjs +3 -17
  25. package/fesm2022/_fake-event-detection-chunk.mjs.map +1 -1
  26. package/fesm2022/_focus-key-manager-chunk.mjs +10 -14
  27. package/fesm2022/_focus-key-manager-chunk.mjs.map +1 -1
  28. package/fesm2022/_focus-monitor-chunk.mjs +376 -566
  29. package/fesm2022/_focus-monitor-chunk.mjs.map +1 -1
  30. package/fesm2022/_id-generator-chunk.mjs +36 -27
  31. package/fesm2022/_id-generator-chunk.mjs.map +1 -1
  32. package/fesm2022/_keycodes-chunk.mjs +9 -9
  33. package/fesm2022/_keycodes-chunk.mjs.map +1 -1
  34. package/fesm2022/_list-key-manager-chunk.mjs +248 -336
  35. package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
  36. package/fesm2022/_overlay-module-chunk.mjs +2534 -2948
  37. package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
  38. package/fesm2022/_passive-listeners-chunk.mjs +10 -22
  39. package/fesm2022/_passive-listeners-chunk.mjs.map +1 -1
  40. package/fesm2022/_platform-chunk.mjs +42 -65
  41. package/fesm2022/_platform-chunk.mjs.map +1 -1
  42. package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs +78 -134
  43. package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs.map +1 -1
  44. package/fesm2022/_scrolling-chunk.mjs +44 -85
  45. package/fesm2022/_scrolling-chunk.mjs.map +1 -1
  46. package/fesm2022/_selection-model-chunk.mjs +138 -209
  47. package/fesm2022/_selection-model-chunk.mjs.map +1 -1
  48. package/fesm2022/_shadow-dom-chunk.mjs +21 -35
  49. package/fesm2022/_shadow-dom-chunk.mjs.map +1 -1
  50. package/fesm2022/_style-loader-chunk.mjs +50 -37
  51. package/fesm2022/_style-loader-chunk.mjs.map +1 -1
  52. package/fesm2022/_test-environment-chunk.mjs +2 -14
  53. package/fesm2022/_test-environment-chunk.mjs.map +1 -1
  54. package/fesm2022/_tree-key-manager-chunk.mjs +229 -308
  55. package/fesm2022/_tree-key-manager-chunk.mjs.map +1 -1
  56. package/fesm2022/_typeahead-chunk.mjs +52 -74
  57. package/fesm2022/_typeahead-chunk.mjs.map +1 -1
  58. package/fesm2022/_unique-selection-dispatcher-chunk.mjs +43 -40
  59. package/fesm2022/_unique-selection-dispatcher-chunk.mjs.map +1 -1
  60. package/fesm2022/a11y.mjs +351 -449
  61. package/fesm2022/a11y.mjs.map +1 -1
  62. package/fesm2022/accordion.mjs +254 -192
  63. package/fesm2022/accordion.mjs.map +1 -1
  64. package/fesm2022/bidi.mjs +121 -64
  65. package/fesm2022/bidi.mjs.map +1 -1
  66. package/fesm2022/cdk.mjs +1 -2
  67. package/fesm2022/cdk.mjs.map +1 -1
  68. package/fesm2022/clipboard.mjs +208 -186
  69. package/fesm2022/clipboard.mjs.map +1 -1
  70. package/fesm2022/coercion-private.mjs +4 -8
  71. package/fesm2022/coercion-private.mjs.map +1 -1
  72. package/fesm2022/coercion.mjs +11 -29
  73. package/fesm2022/coercion.mjs.map +1 -1
  74. package/fesm2022/dialog.mjs +660 -808
  75. package/fesm2022/dialog.mjs.map +1 -1
  76. package/fesm2022/drag-drop.mjs +3347 -4286
  77. package/fesm2022/drag-drop.mjs.map +1 -1
  78. package/fesm2022/keycodes.mjs +4 -8
  79. package/fesm2022/keycodes.mjs.map +1 -1
  80. package/fesm2022/layout.mjs +44 -26
  81. package/fesm2022/layout.mjs.map +1 -1
  82. package/fesm2022/listbox.mjs +841 -895
  83. package/fesm2022/listbox.mjs.map +1 -1
  84. package/fesm2022/menu.mjs +1942 -1858
  85. package/fesm2022/menu.mjs.map +1 -1
  86. package/fesm2022/observers-private.mjs +88 -106
  87. package/fesm2022/observers-private.mjs.map +1 -1
  88. package/fesm2022/observers.mjs +262 -184
  89. package/fesm2022/observers.mjs.map +1 -1
  90. package/fesm2022/overlay.mjs +72 -68
  91. package/fesm2022/overlay.mjs.map +1 -1
  92. package/fesm2022/platform.mjs +43 -54
  93. package/fesm2022/platform.mjs.map +1 -1
  94. package/fesm2022/portal.mjs +402 -560
  95. package/fesm2022/portal.mjs.map +1 -1
  96. package/fesm2022/private.mjs +38 -10
  97. package/fesm2022/private.mjs.map +1 -1
  98. package/fesm2022/scrolling.mjs +1323 -1400
  99. package/fesm2022/scrolling.mjs.map +1 -1
  100. package/fesm2022/stepper.mjs +758 -590
  101. package/fesm2022/stepper.mjs.map +1 -1
  102. package/fesm2022/table.mjs +2327 -2319
  103. package/fesm2022/table.mjs.map +1 -1
  104. package/fesm2022/testing-selenium-webdriver.mjs +252 -325
  105. package/fesm2022/testing-selenium-webdriver.mjs.map +1 -1
  106. package/fesm2022/testing-testbed.mjs +592 -709
  107. package/fesm2022/testing-testbed.mjs.map +1 -1
  108. package/fesm2022/testing.mjs +368 -889
  109. package/fesm2022/testing.mjs.map +1 -1
  110. package/fesm2022/text-field.mjs +459 -388
  111. package/fesm2022/text-field.mjs.map +1 -1
  112. package/fesm2022/tree.mjs +1483 -1731
  113. package/fesm2022/tree.mjs.map +1 -1
  114. package/overlay/_index.scss +28 -0
  115. package/overlay-prebuilt.css +1 -1
  116. package/package.json +1 -1
  117. package/schematics/ng-add/index.js +1 -1
  118. package/types/_harness-environment-chunk.d.ts +1 -2
  119. package/types/_overlay-module-chunk.d.ts +59 -7
  120. package/types/_portal-directives-chunk.d.ts +2 -18
  121. package/types/accordion.d.ts +3 -1
  122. package/types/dialog.d.ts +1 -1
  123. package/types/overlay.d.ts +6 -2
  124. package/types/portal.d.ts +1 -1
@@ -14,2133 +14,2088 @@ import './_element-chunk.mjs';
14
14
  import './_scrolling-chunk.mjs';
15
15
  import './bidi.mjs';
16
16
 
17
- /**
18
- * Used to provide a table to some of the sub-components without causing a circular dependency.
19
- * @docs-private
20
- */
21
17
  const CDK_TABLE = new InjectionToken('CDK_TABLE');
22
- /** Injection token that can be used to specify the text column options. */
23
18
  const TEXT_COLUMN_OPTIONS = new InjectionToken('text-column-options');
24
19
 
25
- /**
26
- * Cell definition for a CDK table.
27
- * Captures the template of a column's data row cell as well as cell-specific properties.
28
- */
29
20
  class CdkCellDef {
30
- /** @docs-private */
31
- template = inject(TemplateRef);
32
- constructor() { }
33
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCellDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
34
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkCellDef, isStandalone: true, selector: "[cdkCellDef]", ngImport: i0 });
21
+ template = inject(TemplateRef);
22
+ constructor() {}
23
+ static ɵfac = i0.ɵɵngDeclareFactory({
24
+ minVersion: "12.0.0",
25
+ version: "20.2.0-next.2",
26
+ ngImport: i0,
27
+ type: CdkCellDef,
28
+ deps: [],
29
+ target: i0.ɵɵFactoryTarget.Directive
30
+ });
31
+ static ɵdir = i0.ɵɵngDeclareDirective({
32
+ minVersion: "14.0.0",
33
+ version: "20.2.0-next.2",
34
+ type: CdkCellDef,
35
+ isStandalone: true,
36
+ selector: "[cdkCellDef]",
37
+ ngImport: i0
38
+ });
35
39
  }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCellDef, decorators: [{
37
- type: Directive,
38
- args: [{
39
- selector: '[cdkCellDef]',
40
- }]
41
- }], ctorParameters: () => [] });
42
- /**
43
- * Header cell definition for a CDK table.
44
- * Captures the template of a column's header cell and as well as cell-specific properties.
45
- */
40
+ i0.ɵɵngDeclareClassMetadata({
41
+ minVersion: "12.0.0",
42
+ version: "20.2.0-next.2",
43
+ ngImport: i0,
44
+ type: CdkCellDef,
45
+ decorators: [{
46
+ type: Directive,
47
+ args: [{
48
+ selector: '[cdkCellDef]'
49
+ }]
50
+ }],
51
+ ctorParameters: () => []
52
+ });
46
53
  class CdkHeaderCellDef {
47
- /** @docs-private */
48
- template = inject(TemplateRef);
49
- constructor() { }
50
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderCellDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
51
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkHeaderCellDef, isStandalone: true, selector: "[cdkHeaderCellDef]", ngImport: i0 });
54
+ template = inject(TemplateRef);
55
+ constructor() {}
56
+ static ɵfac = i0.ɵɵngDeclareFactory({
57
+ minVersion: "12.0.0",
58
+ version: "20.2.0-next.2",
59
+ ngImport: i0,
60
+ type: CdkHeaderCellDef,
61
+ deps: [],
62
+ target: i0.ɵɵFactoryTarget.Directive
63
+ });
64
+ static ɵdir = i0.ɵɵngDeclareDirective({
65
+ minVersion: "14.0.0",
66
+ version: "20.2.0-next.2",
67
+ type: CdkHeaderCellDef,
68
+ isStandalone: true,
69
+ selector: "[cdkHeaderCellDef]",
70
+ ngImport: i0
71
+ });
52
72
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderCellDef, decorators: [{
54
- type: Directive,
55
- args: [{
56
- selector: '[cdkHeaderCellDef]',
57
- }]
58
- }], ctorParameters: () => [] });
59
- /**
60
- * Footer cell definition for a CDK table.
61
- * Captures the template of a column's footer cell and as well as cell-specific properties.
62
- */
73
+ i0.ɵɵngDeclareClassMetadata({
74
+ minVersion: "12.0.0",
75
+ version: "20.2.0-next.2",
76
+ ngImport: i0,
77
+ type: CdkHeaderCellDef,
78
+ decorators: [{
79
+ type: Directive,
80
+ args: [{
81
+ selector: '[cdkHeaderCellDef]'
82
+ }]
83
+ }],
84
+ ctorParameters: () => []
85
+ });
63
86
  class CdkFooterCellDef {
64
- /** @docs-private */
65
- template = inject(TemplateRef);
66
- constructor() { }
67
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterCellDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
68
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkFooterCellDef, isStandalone: true, selector: "[cdkFooterCellDef]", ngImport: i0 });
87
+ template = inject(TemplateRef);
88
+ constructor() {}
89
+ static ɵfac = i0.ɵɵngDeclareFactory({
90
+ minVersion: "12.0.0",
91
+ version: "20.2.0-next.2",
92
+ ngImport: i0,
93
+ type: CdkFooterCellDef,
94
+ deps: [],
95
+ target: i0.ɵɵFactoryTarget.Directive
96
+ });
97
+ static ɵdir = i0.ɵɵngDeclareDirective({
98
+ minVersion: "14.0.0",
99
+ version: "20.2.0-next.2",
100
+ type: CdkFooterCellDef,
101
+ isStandalone: true,
102
+ selector: "[cdkFooterCellDef]",
103
+ ngImport: i0
104
+ });
69
105
  }
70
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterCellDef, decorators: [{
71
- type: Directive,
72
- args: [{
73
- selector: '[cdkFooterCellDef]',
74
- }]
75
- }], ctorParameters: () => [] });
76
- /**
77
- * Column definition for the CDK table.
78
- * Defines a set of cells available for a table column.
79
- */
106
+ i0.ɵɵngDeclareClassMetadata({
107
+ minVersion: "12.0.0",
108
+ version: "20.2.0-next.2",
109
+ ngImport: i0,
110
+ type: CdkFooterCellDef,
111
+ decorators: [{
112
+ type: Directive,
113
+ args: [{
114
+ selector: '[cdkFooterCellDef]'
115
+ }]
116
+ }],
117
+ ctorParameters: () => []
118
+ });
80
119
  class CdkColumnDef {
81
- _table = inject(CDK_TABLE, { optional: true });
82
- _hasStickyChanged = false;
83
- /** Unique name for this column. */
84
- get name() {
85
- return this._name;
86
- }
87
- set name(name) {
88
- this._setNameInput(name);
89
- }
90
- _name;
91
- /** Whether the cell is sticky. */
92
- get sticky() {
93
- return this._sticky;
94
- }
95
- set sticky(value) {
96
- if (value !== this._sticky) {
97
- this._sticky = value;
98
- this._hasStickyChanged = true;
99
- }
100
- }
101
- _sticky = false;
102
- /**
103
- * Whether this column should be sticky positioned on the end of the row. Should make sure
104
- * that it mimics the `CanStick` mixin such that `_hasStickyChanged` is set to true if the value
105
- * has been changed.
106
- */
107
- get stickyEnd() {
108
- return this._stickyEnd;
109
- }
110
- set stickyEnd(value) {
111
- if (value !== this._stickyEnd) {
112
- this._stickyEnd = value;
113
- this._hasStickyChanged = true;
114
- }
115
- }
116
- _stickyEnd = false;
117
- /** @docs-private */
118
- cell;
119
- /** @docs-private */
120
- headerCell;
121
- /** @docs-private */
122
- footerCell;
123
- /**
124
- * Transformed version of the column name that can be used as part of a CSS classname. Excludes
125
- * all non-alphanumeric characters and the special characters '-' and '_'. Any characters that
126
- * do not match are replaced by the '-' character.
127
- */
128
- cssClassFriendlyName;
129
- /**
130
- * Class name for cells in this column.
131
- * @docs-private
132
- */
133
- _columnCssClassName;
134
- constructor() { }
135
- /** Whether the sticky state has changed. */
136
- hasStickyChanged() {
137
- const hasStickyChanged = this._hasStickyChanged;
138
- this.resetStickyChanged();
139
- return hasStickyChanged;
140
- }
141
- /** Resets the sticky changed state. */
142
- resetStickyChanged() {
143
- this._hasStickyChanged = false;
144
- }
145
- /**
146
- * Overridable method that sets the css classes that will be added to every cell in this
147
- * column.
148
- * In the future, columnCssClassName will change from type string[] to string and this
149
- * will set a single string value.
150
- * @docs-private
151
- */
152
- _updateColumnCssClassName() {
153
- this._columnCssClassName = [`cdk-column-${this.cssClassFriendlyName}`];
154
- }
155
- /**
156
- * This has been extracted to a util because of TS 4 and VE.
157
- * View Engine doesn't support property rename inheritance.
158
- * TS 4.0 doesn't allow properties to override accessors or vice-versa.
159
- * @docs-private
160
- */
161
- _setNameInput(value) {
162
- // If the directive is set without a name (updated programmatically), then this setter will
163
- // trigger with an empty string and should not overwrite the programmatically set value.
164
- if (value) {
165
- this._name = value;
166
- this.cssClassFriendlyName = value.replace(/[^a-z0-9_-]/gi, '-');
167
- this._updateColumnCssClassName();
168
- }
169
- }
170
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
171
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.2.0-next.2", 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 });
120
+ _table = inject(CDK_TABLE, {
121
+ optional: true
122
+ });
123
+ _hasStickyChanged = false;
124
+ get name() {
125
+ return this._name;
126
+ }
127
+ set name(name) {
128
+ this._setNameInput(name);
129
+ }
130
+ _name;
131
+ get sticky() {
132
+ return this._sticky;
133
+ }
134
+ set sticky(value) {
135
+ if (value !== this._sticky) {
136
+ this._sticky = value;
137
+ this._hasStickyChanged = true;
138
+ }
139
+ }
140
+ _sticky = false;
141
+ get stickyEnd() {
142
+ return this._stickyEnd;
143
+ }
144
+ set stickyEnd(value) {
145
+ if (value !== this._stickyEnd) {
146
+ this._stickyEnd = value;
147
+ this._hasStickyChanged = true;
148
+ }
149
+ }
150
+ _stickyEnd = false;
151
+ cell;
152
+ headerCell;
153
+ footerCell;
154
+ cssClassFriendlyName;
155
+ _columnCssClassName;
156
+ constructor() {}
157
+ hasStickyChanged() {
158
+ const hasStickyChanged = this._hasStickyChanged;
159
+ this.resetStickyChanged();
160
+ return hasStickyChanged;
161
+ }
162
+ resetStickyChanged() {
163
+ this._hasStickyChanged = false;
164
+ }
165
+ _updateColumnCssClassName() {
166
+ this._columnCssClassName = [`cdk-column-${this.cssClassFriendlyName}`];
167
+ }
168
+ _setNameInput(value) {
169
+ if (value) {
170
+ this._name = value;
171
+ this.cssClassFriendlyName = value.replace(/[^a-z0-9_-]/gi, '-');
172
+ this._updateColumnCssClassName();
173
+ }
174
+ }
175
+ static ɵfac = i0.ɵɵngDeclareFactory({
176
+ minVersion: "12.0.0",
177
+ version: "20.2.0-next.2",
178
+ ngImport: i0,
179
+ type: CdkColumnDef,
180
+ deps: [],
181
+ target: i0.ɵɵFactoryTarget.Directive
182
+ });
183
+ static ɵdir = i0.ɵɵngDeclareDirective({
184
+ minVersion: "16.1.0",
185
+ version: "20.2.0-next.2",
186
+ type: CdkColumnDef,
187
+ isStandalone: true,
188
+ selector: "[cdkColumnDef]",
189
+ inputs: {
190
+ name: ["cdkColumnDef", "name"],
191
+ sticky: ["sticky", "sticky", booleanAttribute],
192
+ stickyEnd: ["stickyEnd", "stickyEnd", booleanAttribute]
193
+ },
194
+ providers: [{
195
+ provide: 'MAT_SORT_HEADER_COLUMN_DEF',
196
+ useExisting: CdkColumnDef
197
+ }],
198
+ queries: [{
199
+ propertyName: "cell",
200
+ first: true,
201
+ predicate: CdkCellDef,
202
+ descendants: true
203
+ }, {
204
+ propertyName: "headerCell",
205
+ first: true,
206
+ predicate: CdkHeaderCellDef,
207
+ descendants: true
208
+ }, {
209
+ propertyName: "footerCell",
210
+ first: true,
211
+ predicate: CdkFooterCellDef,
212
+ descendants: true
213
+ }],
214
+ ngImport: i0
215
+ });
172
216
  }
173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkColumnDef, decorators: [{
174
- type: Directive,
175
- args: [{
176
- selector: '[cdkColumnDef]',
177
- providers: [{ provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: CdkColumnDef }],
178
- }]
179
- }], ctorParameters: () => [], propDecorators: { name: [{
180
- type: Input,
181
- args: ['cdkColumnDef']
182
- }], sticky: [{
183
- type: Input,
184
- args: [{ transform: booleanAttribute }]
185
- }], stickyEnd: [{
186
- type: Input,
187
- args: [{ transform: booleanAttribute }]
188
- }], cell: [{
189
- type: ContentChild,
190
- args: [CdkCellDef]
191
- }], headerCell: [{
192
- type: ContentChild,
193
- args: [CdkHeaderCellDef]
194
- }], footerCell: [{
195
- type: ContentChild,
196
- args: [CdkFooterCellDef]
197
- }] } });
198
- /** Base class for the cells. Adds a CSS classname that identifies the column it renders in. */
217
+ i0.ɵɵngDeclareClassMetadata({
218
+ minVersion: "12.0.0",
219
+ version: "20.2.0-next.2",
220
+ ngImport: i0,
221
+ type: CdkColumnDef,
222
+ decorators: [{
223
+ type: Directive,
224
+ args: [{
225
+ selector: '[cdkColumnDef]',
226
+ providers: [{
227
+ provide: 'MAT_SORT_HEADER_COLUMN_DEF',
228
+ useExisting: CdkColumnDef
229
+ }]
230
+ }]
231
+ }],
232
+ ctorParameters: () => [],
233
+ propDecorators: {
234
+ name: [{
235
+ type: Input,
236
+ args: ['cdkColumnDef']
237
+ }],
238
+ sticky: [{
239
+ type: Input,
240
+ args: [{
241
+ transform: booleanAttribute
242
+ }]
243
+ }],
244
+ stickyEnd: [{
245
+ type: Input,
246
+ args: [{
247
+ transform: booleanAttribute
248
+ }]
249
+ }],
250
+ cell: [{
251
+ type: ContentChild,
252
+ args: [CdkCellDef]
253
+ }],
254
+ headerCell: [{
255
+ type: ContentChild,
256
+ args: [CdkHeaderCellDef]
257
+ }],
258
+ footerCell: [{
259
+ type: ContentChild,
260
+ args: [CdkFooterCellDef]
261
+ }]
262
+ }
263
+ });
199
264
  class BaseCdkCell {
200
- constructor(columnDef, elementRef) {
201
- elementRef.nativeElement.classList.add(...columnDef._columnCssClassName);
202
- }
265
+ constructor(columnDef, elementRef) {
266
+ elementRef.nativeElement.classList.add(...columnDef._columnCssClassName);
267
+ }
203
268
  }
204
- /** Header cell template container that adds the right classes and role. */
205
269
  class CdkHeaderCell extends BaseCdkCell {
206
- constructor() {
207
- super(inject(CdkColumnDef), inject(ElementRef));
208
- }
209
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
210
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkHeaderCell, isStandalone: true, selector: "cdk-header-cell, th[cdk-header-cell]", host: { attributes: { "role": "columnheader" }, classAttribute: "cdk-header-cell" }, usesInheritance: true, ngImport: i0 });
270
+ constructor() {
271
+ super(inject(CdkColumnDef), inject(ElementRef));
272
+ }
273
+ static ɵfac = i0.ɵɵngDeclareFactory({
274
+ minVersion: "12.0.0",
275
+ version: "20.2.0-next.2",
276
+ ngImport: i0,
277
+ type: CdkHeaderCell,
278
+ deps: [],
279
+ target: i0.ɵɵFactoryTarget.Directive
280
+ });
281
+ static ɵdir = i0.ɵɵngDeclareDirective({
282
+ minVersion: "14.0.0",
283
+ version: "20.2.0-next.2",
284
+ type: CdkHeaderCell,
285
+ isStandalone: true,
286
+ selector: "cdk-header-cell, th[cdk-header-cell]",
287
+ host: {
288
+ attributes: {
289
+ "role": "columnheader"
290
+ },
291
+ classAttribute: "cdk-header-cell"
292
+ },
293
+ usesInheritance: true,
294
+ ngImport: i0
295
+ });
211
296
  }
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderCell, decorators: [{
213
- type: Directive,
214
- args: [{
215
- selector: 'cdk-header-cell, th[cdk-header-cell]',
216
- host: {
217
- 'class': 'cdk-header-cell',
218
- 'role': 'columnheader',
219
- },
220
- }]
221
- }], ctorParameters: () => [] });
222
- /** Footer cell template container that adds the right classes and role. */
297
+ i0.ɵɵngDeclareClassMetadata({
298
+ minVersion: "12.0.0",
299
+ version: "20.2.0-next.2",
300
+ ngImport: i0,
301
+ type: CdkHeaderCell,
302
+ decorators: [{
303
+ type: Directive,
304
+ args: [{
305
+ selector: 'cdk-header-cell, th[cdk-header-cell]',
306
+ host: {
307
+ 'class': 'cdk-header-cell',
308
+ 'role': 'columnheader'
309
+ }
310
+ }]
311
+ }],
312
+ ctorParameters: () => []
313
+ });
223
314
  class CdkFooterCell extends BaseCdkCell {
224
- constructor() {
225
- const columnDef = inject(CdkColumnDef);
226
- const elementRef = inject(ElementRef);
227
- super(columnDef, elementRef);
228
- const role = columnDef._table?._getCellRole();
229
- if (role) {
230
- elementRef.nativeElement.setAttribute('role', role);
231
- }
232
- }
233
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
234
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkFooterCell, isStandalone: true, selector: "cdk-footer-cell, td[cdk-footer-cell]", host: { classAttribute: "cdk-footer-cell" }, usesInheritance: true, ngImport: i0 });
315
+ constructor() {
316
+ const columnDef = inject(CdkColumnDef);
317
+ const elementRef = inject(ElementRef);
318
+ super(columnDef, elementRef);
319
+ const role = columnDef._table?._getCellRole();
320
+ if (role) {
321
+ elementRef.nativeElement.setAttribute('role', role);
322
+ }
323
+ }
324
+ static ɵfac = i0.ɵɵngDeclareFactory({
325
+ minVersion: "12.0.0",
326
+ version: "20.2.0-next.2",
327
+ ngImport: i0,
328
+ type: CdkFooterCell,
329
+ deps: [],
330
+ target: i0.ɵɵFactoryTarget.Directive
331
+ });
332
+ static ɵdir = i0.ɵɵngDeclareDirective({
333
+ minVersion: "14.0.0",
334
+ version: "20.2.0-next.2",
335
+ type: CdkFooterCell,
336
+ isStandalone: true,
337
+ selector: "cdk-footer-cell, td[cdk-footer-cell]",
338
+ host: {
339
+ classAttribute: "cdk-footer-cell"
340
+ },
341
+ usesInheritance: true,
342
+ ngImport: i0
343
+ });
235
344
  }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterCell, decorators: [{
237
- type: Directive,
238
- args: [{
239
- selector: 'cdk-footer-cell, td[cdk-footer-cell]',
240
- host: {
241
- 'class': 'cdk-footer-cell',
242
- },
243
- }]
244
- }], ctorParameters: () => [] });
245
- /** Cell template container that adds the right classes and role. */
345
+ i0.ɵɵngDeclareClassMetadata({
346
+ minVersion: "12.0.0",
347
+ version: "20.2.0-next.2",
348
+ ngImport: i0,
349
+ type: CdkFooterCell,
350
+ decorators: [{
351
+ type: Directive,
352
+ args: [{
353
+ selector: 'cdk-footer-cell, td[cdk-footer-cell]',
354
+ host: {
355
+ 'class': 'cdk-footer-cell'
356
+ }
357
+ }]
358
+ }],
359
+ ctorParameters: () => []
360
+ });
246
361
  class CdkCell extends BaseCdkCell {
247
- constructor() {
248
- const columnDef = inject(CdkColumnDef);
249
- const elementRef = inject(ElementRef);
250
- super(columnDef, elementRef);
251
- const role = columnDef._table?._getCellRole();
252
- if (role) {
253
- elementRef.nativeElement.setAttribute('role', role);
254
- }
255
- }
256
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
257
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkCell, isStandalone: true, selector: "cdk-cell, td[cdk-cell]", host: { classAttribute: "cdk-cell" }, usesInheritance: true, ngImport: i0 });
362
+ constructor() {
363
+ const columnDef = inject(CdkColumnDef);
364
+ const elementRef = inject(ElementRef);
365
+ super(columnDef, elementRef);
366
+ const role = columnDef._table?._getCellRole();
367
+ if (role) {
368
+ elementRef.nativeElement.setAttribute('role', role);
369
+ }
370
+ }
371
+ static ɵfac = i0.ɵɵngDeclareFactory({
372
+ minVersion: "12.0.0",
373
+ version: "20.2.0-next.2",
374
+ ngImport: i0,
375
+ type: CdkCell,
376
+ deps: [],
377
+ target: i0.ɵɵFactoryTarget.Directive
378
+ });
379
+ static ɵdir = i0.ɵɵngDeclareDirective({
380
+ minVersion: "14.0.0",
381
+ version: "20.2.0-next.2",
382
+ type: CdkCell,
383
+ isStandalone: true,
384
+ selector: "cdk-cell, td[cdk-cell]",
385
+ host: {
386
+ classAttribute: "cdk-cell"
387
+ },
388
+ usesInheritance: true,
389
+ ngImport: i0
390
+ });
258
391
  }
259
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCell, decorators: [{
260
- type: Directive,
261
- args: [{
262
- selector: 'cdk-cell, td[cdk-cell]',
263
- host: {
264
- 'class': 'cdk-cell',
265
- },
266
- }]
267
- }], ctorParameters: () => [] });
392
+ i0.ɵɵngDeclareClassMetadata({
393
+ minVersion: "12.0.0",
394
+ version: "20.2.0-next.2",
395
+ ngImport: i0,
396
+ type: CdkCell,
397
+ decorators: [{
398
+ type: Directive,
399
+ args: [{
400
+ selector: 'cdk-cell, td[cdk-cell]',
401
+ host: {
402
+ 'class': 'cdk-cell'
403
+ }
404
+ }]
405
+ }],
406
+ ctorParameters: () => []
407
+ });
268
408
 
269
- /**
270
- * The row template that can be used by the mat-table. Should not be used outside of the
271
- * material library.
272
- */
273
409
  const CDK_ROW_TEMPLATE = `<ng-container cdkCellOutlet></ng-container>`;
274
- /**
275
- * Base class for the CdkHeaderRowDef and CdkRowDef that handles checking their columns inputs
276
- * for changes and notifying the table.
277
- */
278
410
  class BaseRowDef {
279
- template = inject(TemplateRef);
280
- _differs = inject(IterableDiffers);
281
- /** The columns to be displayed on this row. */
282
- columns;
283
- /** Differ used to check if any changes were made to the columns. */
284
- _columnsDiffer;
285
- constructor() { }
286
- ngOnChanges(changes) {
287
- // Create a new columns differ if one does not yet exist. Initialize it based on initial value
288
- // of the columns property or an empty array if none is provided.
289
- if (!this._columnsDiffer) {
290
- const columns = (changes['columns'] && changes['columns'].currentValue) || [];
291
- this._columnsDiffer = this._differs.find(columns).create();
292
- this._columnsDiffer.diff(columns);
293
- }
294
- }
295
- /**
296
- * Returns the difference between the current columns and the columns from the last diff, or null
297
- * if there is no difference.
298
- */
299
- getColumnsDiff() {
300
- return this._columnsDiffer.diff(this.columns);
301
- }
302
- /** Gets this row def's relevant cell template from the provided column def. */
303
- extractCellTemplate(column) {
304
- if (this instanceof CdkHeaderRowDef) {
305
- return column.headerCell.template;
306
- }
307
- if (this instanceof CdkFooterRowDef) {
308
- return column.footerCell.template;
309
- }
310
- else {
311
- return column.cell.template;
312
- }
313
- }
314
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: BaseRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
315
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: BaseRowDef, isStandalone: true, usesOnChanges: true, ngImport: i0 });
411
+ template = inject(TemplateRef);
412
+ _differs = inject(IterableDiffers);
413
+ columns;
414
+ _columnsDiffer;
415
+ constructor() {}
416
+ ngOnChanges(changes) {
417
+ if (!this._columnsDiffer) {
418
+ const columns = changes['columns'] && changes['columns'].currentValue || [];
419
+ this._columnsDiffer = this._differs.find(columns).create();
420
+ this._columnsDiffer.diff(columns);
421
+ }
422
+ }
423
+ getColumnsDiff() {
424
+ return this._columnsDiffer.diff(this.columns);
425
+ }
426
+ extractCellTemplate(column) {
427
+ if (this instanceof CdkHeaderRowDef) {
428
+ return column.headerCell.template;
429
+ }
430
+ if (this instanceof CdkFooterRowDef) {
431
+ return column.footerCell.template;
432
+ } else {
433
+ return column.cell.template;
434
+ }
435
+ }
436
+ static ɵfac = i0.ɵɵngDeclareFactory({
437
+ minVersion: "12.0.0",
438
+ version: "20.2.0-next.2",
439
+ ngImport: i0,
440
+ type: BaseRowDef,
441
+ deps: [],
442
+ target: i0.ɵɵFactoryTarget.Directive
443
+ });
444
+ static ɵdir = i0.ɵɵngDeclareDirective({
445
+ minVersion: "14.0.0",
446
+ version: "20.2.0-next.2",
447
+ type: BaseRowDef,
448
+ isStandalone: true,
449
+ usesOnChanges: true,
450
+ ngImport: i0
451
+ });
316
452
  }
317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: BaseRowDef, decorators: [{
318
- type: Directive
319
- }], ctorParameters: () => [] });
320
- /**
321
- * Header row definition for the CDK table.
322
- * Captures the header row's template and other header properties such as the columns to display.
323
- */
453
+ i0.ɵɵngDeclareClassMetadata({
454
+ minVersion: "12.0.0",
455
+ version: "20.2.0-next.2",
456
+ ngImport: i0,
457
+ type: BaseRowDef,
458
+ decorators: [{
459
+ type: Directive
460
+ }],
461
+ ctorParameters: () => []
462
+ });
324
463
  class CdkHeaderRowDef extends BaseRowDef {
325
- _table = inject(CDK_TABLE, { optional: true });
326
- _hasStickyChanged = false;
327
- /** Whether the row is sticky. */
328
- get sticky() {
329
- return this._sticky;
330
- }
331
- set sticky(value) {
332
- if (value !== this._sticky) {
333
- this._sticky = value;
334
- this._hasStickyChanged = true;
335
- }
336
- }
337
- _sticky = false;
338
- constructor() {
339
- super(inject(TemplateRef), inject(IterableDiffers));
340
- }
341
- // Prerender fails to recognize that ngOnChanges in a part of this class through inheritance.
342
- // Explicitly define it so that the method is called as part of the Angular lifecycle.
343
- ngOnChanges(changes) {
344
- super.ngOnChanges(changes);
345
- }
346
- /** Whether the sticky state has changed. */
347
- hasStickyChanged() {
348
- const hasStickyChanged = this._hasStickyChanged;
349
- this.resetStickyChanged();
350
- return hasStickyChanged;
351
- }
352
- /** Resets the sticky changed state. */
353
- resetStickyChanged() {
354
- this._hasStickyChanged = false;
355
- }
356
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
357
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.2.0-next.2", type: CdkHeaderRowDef, isStandalone: true, selector: "[cdkHeaderRowDef]", inputs: { columns: ["cdkHeaderRowDef", "columns"], sticky: ["cdkHeaderRowDefSticky", "sticky", booleanAttribute] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
464
+ _table = inject(CDK_TABLE, {
465
+ optional: true
466
+ });
467
+ _hasStickyChanged = false;
468
+ get sticky() {
469
+ return this._sticky;
470
+ }
471
+ set sticky(value) {
472
+ if (value !== this._sticky) {
473
+ this._sticky = value;
474
+ this._hasStickyChanged = true;
475
+ }
476
+ }
477
+ _sticky = false;
478
+ constructor() {
479
+ super(inject(TemplateRef), inject(IterableDiffers));
480
+ }
481
+ ngOnChanges(changes) {
482
+ super.ngOnChanges(changes);
483
+ }
484
+ hasStickyChanged() {
485
+ const hasStickyChanged = this._hasStickyChanged;
486
+ this.resetStickyChanged();
487
+ return hasStickyChanged;
488
+ }
489
+ resetStickyChanged() {
490
+ this._hasStickyChanged = false;
491
+ }
492
+ static ɵfac = i0.ɵɵngDeclareFactory({
493
+ minVersion: "12.0.0",
494
+ version: "20.2.0-next.2",
495
+ ngImport: i0,
496
+ type: CdkHeaderRowDef,
497
+ deps: [],
498
+ target: i0.ɵɵFactoryTarget.Directive
499
+ });
500
+ static ɵdir = i0.ɵɵngDeclareDirective({
501
+ minVersion: "16.1.0",
502
+ version: "20.2.0-next.2",
503
+ type: CdkHeaderRowDef,
504
+ isStandalone: true,
505
+ selector: "[cdkHeaderRowDef]",
506
+ inputs: {
507
+ columns: ["cdkHeaderRowDef", "columns"],
508
+ sticky: ["cdkHeaderRowDefSticky", "sticky", booleanAttribute]
509
+ },
510
+ usesInheritance: true,
511
+ usesOnChanges: true,
512
+ ngImport: i0
513
+ });
358
514
  }
359
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderRowDef, decorators: [{
360
- type: Directive,
361
- args: [{
362
- selector: '[cdkHeaderRowDef]',
363
- inputs: [{ name: 'columns', alias: 'cdkHeaderRowDef' }],
364
- }]
365
- }], ctorParameters: () => [], propDecorators: { sticky: [{
366
- type: Input,
367
- args: [{ alias: 'cdkHeaderRowDefSticky', transform: booleanAttribute }]
368
- }] } });
369
- /**
370
- * Footer row definition for the CDK table.
371
- * Captures the footer row's template and other footer properties such as the columns to display.
372
- */
515
+ i0.ɵɵngDeclareClassMetadata({
516
+ minVersion: "12.0.0",
517
+ version: "20.2.0-next.2",
518
+ ngImport: i0,
519
+ type: CdkHeaderRowDef,
520
+ decorators: [{
521
+ type: Directive,
522
+ args: [{
523
+ selector: '[cdkHeaderRowDef]',
524
+ inputs: [{
525
+ name: 'columns',
526
+ alias: 'cdkHeaderRowDef'
527
+ }]
528
+ }]
529
+ }],
530
+ ctorParameters: () => [],
531
+ propDecorators: {
532
+ sticky: [{
533
+ type: Input,
534
+ args: [{
535
+ alias: 'cdkHeaderRowDefSticky',
536
+ transform: booleanAttribute
537
+ }]
538
+ }]
539
+ }
540
+ });
373
541
  class CdkFooterRowDef extends BaseRowDef {
374
- _table = inject(CDK_TABLE, { optional: true });
375
- _hasStickyChanged = false;
376
- /** Whether the row is sticky. */
377
- get sticky() {
378
- return this._sticky;
379
- }
380
- set sticky(value) {
381
- if (value !== this._sticky) {
382
- this._sticky = value;
383
- this._hasStickyChanged = true;
384
- }
385
- }
386
- _sticky = false;
387
- constructor() {
388
- super(inject(TemplateRef), inject(IterableDiffers));
389
- }
390
- // Prerender fails to recognize that ngOnChanges in a part of this class through inheritance.
391
- // Explicitly define it so that the method is called as part of the Angular lifecycle.
392
- ngOnChanges(changes) {
393
- super.ngOnChanges(changes);
394
- }
395
- /** Whether the sticky state has changed. */
396
- hasStickyChanged() {
397
- const hasStickyChanged = this._hasStickyChanged;
398
- this.resetStickyChanged();
399
- return hasStickyChanged;
400
- }
401
- /** Resets the sticky changed state. */
402
- resetStickyChanged() {
403
- this._hasStickyChanged = false;
404
- }
405
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
406
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.2.0-next.2", type: CdkFooterRowDef, isStandalone: true, selector: "[cdkFooterRowDef]", inputs: { columns: ["cdkFooterRowDef", "columns"], sticky: ["cdkFooterRowDefSticky", "sticky", booleanAttribute] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
542
+ _table = inject(CDK_TABLE, {
543
+ optional: true
544
+ });
545
+ _hasStickyChanged = false;
546
+ get sticky() {
547
+ return this._sticky;
548
+ }
549
+ set sticky(value) {
550
+ if (value !== this._sticky) {
551
+ this._sticky = value;
552
+ this._hasStickyChanged = true;
553
+ }
554
+ }
555
+ _sticky = false;
556
+ constructor() {
557
+ super(inject(TemplateRef), inject(IterableDiffers));
558
+ }
559
+ ngOnChanges(changes) {
560
+ super.ngOnChanges(changes);
561
+ }
562
+ hasStickyChanged() {
563
+ const hasStickyChanged = this._hasStickyChanged;
564
+ this.resetStickyChanged();
565
+ return hasStickyChanged;
566
+ }
567
+ resetStickyChanged() {
568
+ this._hasStickyChanged = false;
569
+ }
570
+ static ɵfac = i0.ɵɵngDeclareFactory({
571
+ minVersion: "12.0.0",
572
+ version: "20.2.0-next.2",
573
+ ngImport: i0,
574
+ type: CdkFooterRowDef,
575
+ deps: [],
576
+ target: i0.ɵɵFactoryTarget.Directive
577
+ });
578
+ static ɵdir = i0.ɵɵngDeclareDirective({
579
+ minVersion: "16.1.0",
580
+ version: "20.2.0-next.2",
581
+ type: CdkFooterRowDef,
582
+ isStandalone: true,
583
+ selector: "[cdkFooterRowDef]",
584
+ inputs: {
585
+ columns: ["cdkFooterRowDef", "columns"],
586
+ sticky: ["cdkFooterRowDefSticky", "sticky", booleanAttribute]
587
+ },
588
+ usesInheritance: true,
589
+ usesOnChanges: true,
590
+ ngImport: i0
591
+ });
407
592
  }
408
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterRowDef, decorators: [{
409
- type: Directive,
410
- args: [{
411
- selector: '[cdkFooterRowDef]',
412
- inputs: [{ name: 'columns', alias: 'cdkFooterRowDef' }],
413
- }]
414
- }], ctorParameters: () => [], propDecorators: { sticky: [{
415
- type: Input,
416
- args: [{ alias: 'cdkFooterRowDefSticky', transform: booleanAttribute }]
417
- }] } });
418
- /**
419
- * Data row definition for the CDK table.
420
- * Captures the header row's template and other row properties such as the columns to display and
421
- * a when predicate that describes when this row should be used.
422
- */
593
+ i0.ɵɵngDeclareClassMetadata({
594
+ minVersion: "12.0.0",
595
+ version: "20.2.0-next.2",
596
+ ngImport: i0,
597
+ type: CdkFooterRowDef,
598
+ decorators: [{
599
+ type: Directive,
600
+ args: [{
601
+ selector: '[cdkFooterRowDef]',
602
+ inputs: [{
603
+ name: 'columns',
604
+ alias: 'cdkFooterRowDef'
605
+ }]
606
+ }]
607
+ }],
608
+ ctorParameters: () => [],
609
+ propDecorators: {
610
+ sticky: [{
611
+ type: Input,
612
+ args: [{
613
+ alias: 'cdkFooterRowDefSticky',
614
+ transform: booleanAttribute
615
+ }]
616
+ }]
617
+ }
618
+ });
423
619
  class CdkRowDef extends BaseRowDef {
424
- _table = inject(CDK_TABLE, { optional: true });
425
- /**
426
- * Function that should return true if this row template should be used for the provided index
427
- * and row data. If left undefined, this row will be considered the default row template to use
428
- * when no other when functions return true for the data.
429
- * For every row, there must be at least one when function that passes or an undefined to default.
430
- */
431
- when;
432
- constructor() {
433
- // TODO(andrewseguin): Add an input for providing a switch function to determine
434
- // if this template should be used.
435
- super(inject(TemplateRef), inject(IterableDiffers));
436
- }
437
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
438
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkRowDef, isStandalone: true, selector: "[cdkRowDef]", inputs: { columns: ["cdkRowDefColumns", "columns"], when: ["cdkRowDefWhen", "when"] }, usesInheritance: true, ngImport: i0 });
620
+ _table = inject(CDK_TABLE, {
621
+ optional: true
622
+ });
623
+ when;
624
+ constructor() {
625
+ super(inject(TemplateRef), inject(IterableDiffers));
626
+ }
627
+ static ɵfac = i0.ɵɵngDeclareFactory({
628
+ minVersion: "12.0.0",
629
+ version: "20.2.0-next.2",
630
+ ngImport: i0,
631
+ type: CdkRowDef,
632
+ deps: [],
633
+ target: i0.ɵɵFactoryTarget.Directive
634
+ });
635
+ static ɵdir = i0.ɵɵngDeclareDirective({
636
+ minVersion: "14.0.0",
637
+ version: "20.2.0-next.2",
638
+ type: CdkRowDef,
639
+ isStandalone: true,
640
+ selector: "[cdkRowDef]",
641
+ inputs: {
642
+ columns: ["cdkRowDefColumns", "columns"],
643
+ when: ["cdkRowDefWhen", "when"]
644
+ },
645
+ usesInheritance: true,
646
+ ngImport: i0
647
+ });
439
648
  }
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRowDef, decorators: [{
441
- type: Directive,
442
- args: [{
443
- selector: '[cdkRowDef]',
444
- inputs: [
445
- { name: 'columns', alias: 'cdkRowDefColumns' },
446
- { name: 'when', alias: 'cdkRowDefWhen' },
447
- ],
448
- }]
449
- }], ctorParameters: () => [] });
450
- /**
451
- * Outlet for rendering cells inside of a row or header row.
452
- * @docs-private
453
- */
649
+ i0.ɵɵngDeclareClassMetadata({
650
+ minVersion: "12.0.0",
651
+ version: "20.2.0-next.2",
652
+ ngImport: i0,
653
+ type: CdkRowDef,
654
+ decorators: [{
655
+ type: Directive,
656
+ args: [{
657
+ selector: '[cdkRowDef]',
658
+ inputs: [{
659
+ name: 'columns',
660
+ alias: 'cdkRowDefColumns'
661
+ }, {
662
+ name: 'when',
663
+ alias: 'cdkRowDefWhen'
664
+ }]
665
+ }]
666
+ }],
667
+ ctorParameters: () => []
668
+ });
454
669
  class CdkCellOutlet {
455
- _viewContainer = inject(ViewContainerRef);
456
- /** The ordered list of cells to render within this outlet's view container */
457
- cells;
458
- /** The data context to be provided to each cell */
459
- context;
460
- /**
461
- * Static property containing the latest constructed instance of this class.
462
- * Used by the CDK table when each CdkHeaderRow and CdkRow component is created using
463
- * createEmbeddedView. After one of these components are created, this property will provide
464
- * a handle to provide that component's cells and context. After init, the CdkCellOutlet will
465
- * construct the cells with the provided context.
466
- */
467
- static mostRecentCellOutlet = null;
468
- constructor() {
469
- CdkCellOutlet.mostRecentCellOutlet = this;
470
- }
471
- ngOnDestroy() {
472
- // If this was the last outlet being rendered in the view, remove the reference
473
- // from the static property after it has been destroyed to avoid leaking memory.
474
- if (CdkCellOutlet.mostRecentCellOutlet === this) {
475
- CdkCellOutlet.mostRecentCellOutlet = null;
476
- }
477
- }
478
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCellOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
479
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkCellOutlet, isStandalone: true, selector: "[cdkCellOutlet]", ngImport: i0 });
670
+ _viewContainer = inject(ViewContainerRef);
671
+ cells;
672
+ context;
673
+ static mostRecentCellOutlet = null;
674
+ constructor() {
675
+ CdkCellOutlet.mostRecentCellOutlet = this;
676
+ }
677
+ ngOnDestroy() {
678
+ if (CdkCellOutlet.mostRecentCellOutlet === this) {
679
+ CdkCellOutlet.mostRecentCellOutlet = null;
680
+ }
681
+ }
682
+ static ɵfac = i0.ɵɵngDeclareFactory({
683
+ minVersion: "12.0.0",
684
+ version: "20.2.0-next.2",
685
+ ngImport: i0,
686
+ type: CdkCellOutlet,
687
+ deps: [],
688
+ target: i0.ɵɵFactoryTarget.Directive
689
+ });
690
+ static ɵdir = i0.ɵɵngDeclareDirective({
691
+ minVersion: "14.0.0",
692
+ version: "20.2.0-next.2",
693
+ type: CdkCellOutlet,
694
+ isStandalone: true,
695
+ selector: "[cdkCellOutlet]",
696
+ ngImport: i0
697
+ });
480
698
  }
481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkCellOutlet, decorators: [{
482
- type: Directive,
483
- args: [{
484
- selector: '[cdkCellOutlet]',
485
- }]
486
- }], ctorParameters: () => [] });
487
- /** Header template container that contains the cell outlet. Adds the right class and role. */
699
+ i0.ɵɵngDeclareClassMetadata({
700
+ minVersion: "12.0.0",
701
+ version: "20.2.0-next.2",
702
+ ngImport: i0,
703
+ type: CdkCellOutlet,
704
+ decorators: [{
705
+ type: Directive,
706
+ args: [{
707
+ selector: '[cdkCellOutlet]'
708
+ }]
709
+ }],
710
+ ctorParameters: () => []
711
+ });
488
712
  class CdkHeaderRow {
489
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderRow, deps: [], target: i0.ɵɵFactoryTarget.Component });
490
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkHeaderRow, isStandalone: true, selector: "cdk-header-row, tr[cdk-header-row]", host: { attributes: { "role": "row" }, classAttribute: "cdk-header-row" }, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
713
+ static ɵfac = i0.ɵɵngDeclareFactory({
714
+ minVersion: "12.0.0",
715
+ version: "20.2.0-next.2",
716
+ ngImport: i0,
717
+ type: CdkHeaderRow,
718
+ deps: [],
719
+ target: i0.ɵɵFactoryTarget.Component
720
+ });
721
+ static ɵcmp = i0.ɵɵngDeclareComponent({
722
+ minVersion: "14.0.0",
723
+ version: "20.2.0-next.2",
724
+ type: CdkHeaderRow,
725
+ isStandalone: true,
726
+ selector: "cdk-header-row, tr[cdk-header-row]",
727
+ host: {
728
+ attributes: {
729
+ "role": "row"
730
+ },
731
+ classAttribute: "cdk-header-row"
732
+ },
733
+ ngImport: i0,
734
+ template: "<ng-container cdkCellOutlet></ng-container>",
735
+ isInline: true,
736
+ dependencies: [{
737
+ kind: "directive",
738
+ type: CdkCellOutlet,
739
+ selector: "[cdkCellOutlet]"
740
+ }],
741
+ changeDetection: i0.ChangeDetectionStrategy.Default,
742
+ encapsulation: i0.ViewEncapsulation.None
743
+ });
491
744
  }
492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkHeaderRow, decorators: [{
493
- type: Component,
494
- args: [{
495
- selector: 'cdk-header-row, tr[cdk-header-row]',
496
- template: CDK_ROW_TEMPLATE,
497
- host: {
498
- 'class': 'cdk-header-row',
499
- 'role': 'row',
500
- },
501
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
502
- // tslint:disable-next-line:validate-decorators
503
- changeDetection: ChangeDetectionStrategy.Default,
504
- encapsulation: ViewEncapsulation.None,
505
- imports: [CdkCellOutlet],
506
- }]
507
- }] });
508
- /** Footer template container that contains the cell outlet. Adds the right class and role. */
745
+ i0.ɵɵngDeclareClassMetadata({
746
+ minVersion: "12.0.0",
747
+ version: "20.2.0-next.2",
748
+ ngImport: i0,
749
+ type: CdkHeaderRow,
750
+ decorators: [{
751
+ type: Component,
752
+ args: [{
753
+ selector: 'cdk-header-row, tr[cdk-header-row]',
754
+ template: CDK_ROW_TEMPLATE,
755
+ host: {
756
+ 'class': 'cdk-header-row',
757
+ 'role': 'row'
758
+ },
759
+ changeDetection: ChangeDetectionStrategy.Default,
760
+ encapsulation: ViewEncapsulation.None,
761
+ imports: [CdkCellOutlet]
762
+ }]
763
+ }]
764
+ });
509
765
  class CdkFooterRow {
510
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterRow, deps: [], target: i0.ɵɵFactoryTarget.Component });
511
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkFooterRow, isStandalone: true, selector: "cdk-footer-row, tr[cdk-footer-row]", host: { attributes: { "role": "row" }, classAttribute: "cdk-footer-row" }, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
766
+ static ɵfac = i0.ɵɵngDeclareFactory({
767
+ minVersion: "12.0.0",
768
+ version: "20.2.0-next.2",
769
+ ngImport: i0,
770
+ type: CdkFooterRow,
771
+ deps: [],
772
+ target: i0.ɵɵFactoryTarget.Component
773
+ });
774
+ static ɵcmp = i0.ɵɵngDeclareComponent({
775
+ minVersion: "14.0.0",
776
+ version: "20.2.0-next.2",
777
+ type: CdkFooterRow,
778
+ isStandalone: true,
779
+ selector: "cdk-footer-row, tr[cdk-footer-row]",
780
+ host: {
781
+ attributes: {
782
+ "role": "row"
783
+ },
784
+ classAttribute: "cdk-footer-row"
785
+ },
786
+ ngImport: i0,
787
+ template: "<ng-container cdkCellOutlet></ng-container>",
788
+ isInline: true,
789
+ dependencies: [{
790
+ kind: "directive",
791
+ type: CdkCellOutlet,
792
+ selector: "[cdkCellOutlet]"
793
+ }],
794
+ changeDetection: i0.ChangeDetectionStrategy.Default,
795
+ encapsulation: i0.ViewEncapsulation.None
796
+ });
512
797
  }
513
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkFooterRow, decorators: [{
514
- type: Component,
515
- args: [{
516
- selector: 'cdk-footer-row, tr[cdk-footer-row]',
517
- template: CDK_ROW_TEMPLATE,
518
- host: {
519
- 'class': 'cdk-footer-row',
520
- 'role': 'row',
521
- },
522
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
523
- // tslint:disable-next-line:validate-decorators
524
- changeDetection: ChangeDetectionStrategy.Default,
525
- encapsulation: ViewEncapsulation.None,
526
- imports: [CdkCellOutlet],
527
- }]
528
- }] });
529
- /** Data row template container that contains the cell outlet. Adds the right class and role. */
798
+ i0.ɵɵngDeclareClassMetadata({
799
+ minVersion: "12.0.0",
800
+ version: "20.2.0-next.2",
801
+ ngImport: i0,
802
+ type: CdkFooterRow,
803
+ decorators: [{
804
+ type: Component,
805
+ args: [{
806
+ selector: 'cdk-footer-row, tr[cdk-footer-row]',
807
+ template: CDK_ROW_TEMPLATE,
808
+ host: {
809
+ 'class': 'cdk-footer-row',
810
+ 'role': 'row'
811
+ },
812
+ changeDetection: ChangeDetectionStrategy.Default,
813
+ encapsulation: ViewEncapsulation.None,
814
+ imports: [CdkCellOutlet]
815
+ }]
816
+ }]
817
+ });
530
818
  class CdkRow {
531
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRow, deps: [], target: i0.ɵɵFactoryTarget.Component });
532
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkRow, isStandalone: true, selector: "cdk-row, tr[cdk-row]", host: { attributes: { "role": "row" }, classAttribute: "cdk-row" }, ngImport: i0, template: "<ng-container cdkCellOutlet></ng-container>", isInline: true, dependencies: [{ kind: "directive", type: CdkCellOutlet, selector: "[cdkCellOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
819
+ static ɵfac = i0.ɵɵngDeclareFactory({
820
+ minVersion: "12.0.0",
821
+ version: "20.2.0-next.2",
822
+ ngImport: i0,
823
+ type: CdkRow,
824
+ deps: [],
825
+ target: i0.ɵɵFactoryTarget.Component
826
+ });
827
+ static ɵcmp = i0.ɵɵngDeclareComponent({
828
+ minVersion: "14.0.0",
829
+ version: "20.2.0-next.2",
830
+ type: CdkRow,
831
+ isStandalone: true,
832
+ selector: "cdk-row, tr[cdk-row]",
833
+ host: {
834
+ attributes: {
835
+ "role": "row"
836
+ },
837
+ classAttribute: "cdk-row"
838
+ },
839
+ ngImport: i0,
840
+ template: "<ng-container cdkCellOutlet></ng-container>",
841
+ isInline: true,
842
+ dependencies: [{
843
+ kind: "directive",
844
+ type: CdkCellOutlet,
845
+ selector: "[cdkCellOutlet]"
846
+ }],
847
+ changeDetection: i0.ChangeDetectionStrategy.Default,
848
+ encapsulation: i0.ViewEncapsulation.None
849
+ });
533
850
  }
534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRow, decorators: [{
535
- type: Component,
536
- args: [{
537
- selector: 'cdk-row, tr[cdk-row]',
538
- template: CDK_ROW_TEMPLATE,
539
- host: {
540
- 'class': 'cdk-row',
541
- 'role': 'row',
542
- },
543
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
544
- // tslint:disable-next-line:validate-decorators
545
- changeDetection: ChangeDetectionStrategy.Default,
546
- encapsulation: ViewEncapsulation.None,
547
- imports: [CdkCellOutlet],
548
- }]
549
- }] });
550
- /** Row that can be used to display a message when no data is shown in the table. */
851
+ i0.ɵɵngDeclareClassMetadata({
852
+ minVersion: "12.0.0",
853
+ version: "20.2.0-next.2",
854
+ ngImport: i0,
855
+ type: CdkRow,
856
+ decorators: [{
857
+ type: Component,
858
+ args: [{
859
+ selector: 'cdk-row, tr[cdk-row]',
860
+ template: CDK_ROW_TEMPLATE,
861
+ host: {
862
+ 'class': 'cdk-row',
863
+ 'role': 'row'
864
+ },
865
+ changeDetection: ChangeDetectionStrategy.Default,
866
+ encapsulation: ViewEncapsulation.None,
867
+ imports: [CdkCellOutlet]
868
+ }]
869
+ }]
870
+ });
551
871
  class CdkNoDataRow {
552
- templateRef = inject(TemplateRef);
553
- _contentClassNames = ['cdk-no-data-row', 'cdk-row'];
554
- _cellClassNames = ['cdk-cell', 'cdk-no-data-cell'];
555
- _cellSelector = 'td, cdk-cell, [cdk-cell], .cdk-cell';
556
- constructor() { }
557
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkNoDataRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
558
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkNoDataRow, isStandalone: true, selector: "ng-template[cdkNoDataRow]", ngImport: i0 });
872
+ templateRef = inject(TemplateRef);
873
+ _contentClassNames = ['cdk-no-data-row', 'cdk-row'];
874
+ _cellClassNames = ['cdk-cell', 'cdk-no-data-cell'];
875
+ _cellSelector = 'td, cdk-cell, [cdk-cell], .cdk-cell';
876
+ constructor() {}
877
+ static ɵfac = i0.ɵɵngDeclareFactory({
878
+ minVersion: "12.0.0",
879
+ version: "20.2.0-next.2",
880
+ ngImport: i0,
881
+ type: CdkNoDataRow,
882
+ deps: [],
883
+ target: i0.ɵɵFactoryTarget.Directive
884
+ });
885
+ static ɵdir = i0.ɵɵngDeclareDirective({
886
+ minVersion: "14.0.0",
887
+ version: "20.2.0-next.2",
888
+ type: CdkNoDataRow,
889
+ isStandalone: true,
890
+ selector: "ng-template[cdkNoDataRow]",
891
+ ngImport: i0
892
+ });
559
893
  }
560
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkNoDataRow, decorators: [{
561
- type: Directive,
562
- args: [{
563
- selector: 'ng-template[cdkNoDataRow]',
564
- }]
565
- }], ctorParameters: () => [] });
894
+ i0.ɵɵngDeclareClassMetadata({
895
+ minVersion: "12.0.0",
896
+ version: "20.2.0-next.2",
897
+ ngImport: i0,
898
+ type: CdkNoDataRow,
899
+ decorators: [{
900
+ type: Directive,
901
+ args: [{
902
+ selector: 'ng-template[cdkNoDataRow]'
903
+ }]
904
+ }],
905
+ ctorParameters: () => []
906
+ });
566
907
 
567
- /**
568
- * Directions that can be used when setting sticky positioning.
569
- * @docs-private
570
- */
571
- /**
572
- * List of all possible directions that can be used for sticky positioning.
573
- * @docs-private
574
- */
575
908
  const STICKY_DIRECTIONS = ['top', 'bottom', 'left', 'right'];
576
- /**
577
- * Applies and removes sticky positioning styles to the `CdkTable` rows and columns cells.
578
- * @docs-private
579
- */
580
909
  class StickyStyler {
581
- _isNativeHtmlTable;
582
- _stickCellCss;
583
- _isBrowser;
584
- _needsPositionStickyOnElement;
585
- direction;
586
- _positionListener;
587
- _tableInjector;
588
- _elemSizeCache = new WeakMap();
589
- _resizeObserver = globalThis?.ResizeObserver
590
- ? new globalThis.ResizeObserver(entries => this._updateCachedSizes(entries))
591
- : null;
592
- _updatedStickyColumnsParamsToReplay = [];
593
- _stickyColumnsReplayTimeout = null;
594
- _cachedCellWidths = [];
595
- _borderCellCss;
596
- _destroyed = false;
597
- /**
598
- * @param _isNativeHtmlTable Whether the sticky logic should be based on a table
599
- * that uses the native `<table>` element.
600
- * @param _stickCellCss The CSS class that will be applied to every row/cell that has
601
- * sticky positioning applied.
602
- * @param direction The directionality context of the table (ltr/rtl); affects column positioning
603
- * by reversing left/right positions.
604
- * @param _isBrowser Whether the table is currently being rendered on the server or the client.
605
- * @param _needsPositionStickyOnElement Whether we need to specify position: sticky on cells
606
- * using inline styles. If false, it is assumed that position: sticky is included in
607
- * the component stylesheet for _stickCellCss.
608
- * @param _positionListener A listener that is notified of changes to sticky rows/columns
609
- * and their dimensions.
610
- * @param _tableInjector The table's Injector.
611
- */
612
- constructor(_isNativeHtmlTable, _stickCellCss, _isBrowser = true, _needsPositionStickyOnElement = true, direction, _positionListener, _tableInjector) {
613
- this._isNativeHtmlTable = _isNativeHtmlTable;
614
- this._stickCellCss = _stickCellCss;
615
- this._isBrowser = _isBrowser;
616
- this._needsPositionStickyOnElement = _needsPositionStickyOnElement;
617
- this.direction = direction;
618
- this._positionListener = _positionListener;
619
- this._tableInjector = _tableInjector;
620
- this._borderCellCss = {
621
- 'top': `${_stickCellCss}-border-elem-top`,
622
- 'bottom': `${_stickCellCss}-border-elem-bottom`,
623
- 'left': `${_stickCellCss}-border-elem-left`,
624
- 'right': `${_stickCellCss}-border-elem-right`,
625
- };
626
- }
627
- /**
628
- * Clears the sticky positioning styles from the row and its cells by resetting the `position`
629
- * style, setting the zIndex to 0, and unsetting each provided sticky direction.
630
- * @param rows The list of rows that should be cleared from sticking in the provided directions
631
- * @param stickyDirections The directions that should no longer be set as sticky on the rows.
632
- */
633
- clearStickyPositioning(rows, stickyDirections) {
634
- if (stickyDirections.includes('left') || stickyDirections.includes('right')) {
635
- this._removeFromStickyColumnReplayQueue(rows);
636
- }
637
- const elementsToClear = [];
910
+ _isNativeHtmlTable;
911
+ _stickCellCss;
912
+ _isBrowser;
913
+ _needsPositionStickyOnElement;
914
+ direction;
915
+ _positionListener;
916
+ _tableInjector;
917
+ _elemSizeCache = new WeakMap();
918
+ _resizeObserver = globalThis?.ResizeObserver ? new globalThis.ResizeObserver(entries => this._updateCachedSizes(entries)) : null;
919
+ _updatedStickyColumnsParamsToReplay = [];
920
+ _stickyColumnsReplayTimeout = null;
921
+ _cachedCellWidths = [];
922
+ _borderCellCss;
923
+ _destroyed = false;
924
+ constructor(_isNativeHtmlTable, _stickCellCss, _isBrowser = true, _needsPositionStickyOnElement = true, direction, _positionListener, _tableInjector) {
925
+ this._isNativeHtmlTable = _isNativeHtmlTable;
926
+ this._stickCellCss = _stickCellCss;
927
+ this._isBrowser = _isBrowser;
928
+ this._needsPositionStickyOnElement = _needsPositionStickyOnElement;
929
+ this.direction = direction;
930
+ this._positionListener = _positionListener;
931
+ this._tableInjector = _tableInjector;
932
+ this._borderCellCss = {
933
+ 'top': `${_stickCellCss}-border-elem-top`,
934
+ 'bottom': `${_stickCellCss}-border-elem-bottom`,
935
+ 'left': `${_stickCellCss}-border-elem-left`,
936
+ 'right': `${_stickCellCss}-border-elem-right`
937
+ };
938
+ }
939
+ clearStickyPositioning(rows, stickyDirections) {
940
+ if (stickyDirections.includes('left') || stickyDirections.includes('right')) {
941
+ this._removeFromStickyColumnReplayQueue(rows);
942
+ }
943
+ const elementsToClear = [];
944
+ for (const row of rows) {
945
+ if (row.nodeType !== row.ELEMENT_NODE) {
946
+ continue;
947
+ }
948
+ elementsToClear.push(row, ...Array.from(row.children));
949
+ }
950
+ afterNextRender({
951
+ write: () => {
952
+ for (const element of elementsToClear) {
953
+ this._removeStickyStyle(element, stickyDirections);
954
+ }
955
+ }
956
+ }, {
957
+ injector: this._tableInjector
958
+ });
959
+ }
960
+ updateStickyColumns(rows, stickyStartStates, stickyEndStates, recalculateCellWidths = true, replay = true) {
961
+ if (!rows.length || !this._isBrowser || !(stickyStartStates.some(state => state) || stickyEndStates.some(state => state))) {
962
+ this._positionListener?.stickyColumnsUpdated({
963
+ sizes: []
964
+ });
965
+ this._positionListener?.stickyEndColumnsUpdated({
966
+ sizes: []
967
+ });
968
+ return;
969
+ }
970
+ const firstRow = rows[0];
971
+ const numCells = firstRow.children.length;
972
+ const isRtl = this.direction === 'rtl';
973
+ const start = isRtl ? 'right' : 'left';
974
+ const end = isRtl ? 'left' : 'right';
975
+ const lastStickyStart = stickyStartStates.lastIndexOf(true);
976
+ const firstStickyEnd = stickyEndStates.indexOf(true);
977
+ let cellWidths;
978
+ let startPositions;
979
+ let endPositions;
980
+ if (replay) {
981
+ this._updateStickyColumnReplayQueue({
982
+ rows: [...rows],
983
+ stickyStartStates: [...stickyStartStates],
984
+ stickyEndStates: [...stickyEndStates]
985
+ });
986
+ }
987
+ afterNextRender({
988
+ earlyRead: () => {
989
+ cellWidths = this._getCellWidths(firstRow, recalculateCellWidths);
990
+ startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates);
991
+ endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates);
992
+ },
993
+ write: () => {
638
994
  for (const row of rows) {
639
- // If the row isn't an element (e.g. if it's an `ng-container`),
640
- // it won't have inline styles or `children` so we skip it.
641
- if (row.nodeType !== row.ELEMENT_NODE) {
642
- continue;
995
+ for (let i = 0; i < numCells; i++) {
996
+ const cell = row.children[i];
997
+ if (stickyStartStates[i]) {
998
+ this._addStickyStyle(cell, start, startPositions[i], i === lastStickyStart);
643
999
  }
644
- elementsToClear.push(row, ...Array.from(row.children));
645
- }
646
- // Coalesce with sticky row/column updates (and potentially other changes like column resize).
647
- afterNextRender({
648
- write: () => {
649
- for (const element of elementsToClear) {
650
- this._removeStickyStyle(element, stickyDirections);
651
- }
652
- },
653
- }, {
654
- injector: this._tableInjector,
655
- });
656
- }
657
- /**
658
- * Applies sticky left and right positions to the cells of each row according to the sticky
659
- * states of the rendered column definitions.
660
- * @param rows The rows that should have its set of cells stuck according to the sticky states.
661
- * @param stickyStartStates A list of boolean states where each state represents whether the cell
662
- * in this index position should be stuck to the start of the row.
663
- * @param stickyEndStates A list of boolean states where each state represents whether the cell
664
- * in this index position should be stuck to the end of the row.
665
- * @param recalculateCellWidths Whether the sticky styler should recalculate the width of each
666
- * column cell. If `false` cached widths will be used instead.
667
- * @param replay Whether to enqueue this call for replay after a ResizeObserver update.
668
- */
669
- updateStickyColumns(rows, stickyStartStates, stickyEndStates, recalculateCellWidths = true, replay = true) {
670
- // Don't cache any state if none of the columns are sticky.
671
- if (!rows.length ||
672
- !this._isBrowser ||
673
- !(stickyStartStates.some(state => state) || stickyEndStates.some(state => state))) {
674
- this._positionListener?.stickyColumnsUpdated({ sizes: [] });
675
- this._positionListener?.stickyEndColumnsUpdated({ sizes: [] });
676
- return;
677
- }
678
- // Coalesce with sticky row updates (and potentially other changes like column resize).
679
- const firstRow = rows[0];
680
- const numCells = firstRow.children.length;
681
- const isRtl = this.direction === 'rtl';
682
- const start = isRtl ? 'right' : 'left';
683
- const end = isRtl ? 'left' : 'right';
684
- const lastStickyStart = stickyStartStates.lastIndexOf(true);
685
- const firstStickyEnd = stickyEndStates.indexOf(true);
686
- let cellWidths;
687
- let startPositions;
688
- let endPositions;
689
- if (replay) {
690
- this._updateStickyColumnReplayQueue({
691
- rows: [...rows],
692
- stickyStartStates: [...stickyStartStates],
693
- stickyEndStates: [...stickyEndStates],
694
- });
695
- }
696
- afterNextRender({
697
- earlyRead: () => {
698
- cellWidths = this._getCellWidths(firstRow, recalculateCellWidths);
699
- startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates);
700
- endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates);
701
- },
702
- write: () => {
703
- for (const row of rows) {
704
- for (let i = 0; i < numCells; i++) {
705
- const cell = row.children[i];
706
- if (stickyStartStates[i]) {
707
- this._addStickyStyle(cell, start, startPositions[i], i === lastStickyStart);
708
- }
709
- if (stickyEndStates[i]) {
710
- this._addStickyStyle(cell, end, endPositions[i], i === firstStickyEnd);
711
- }
712
- }
713
- }
714
- if (this._positionListener && cellWidths.some(w => !!w)) {
715
- this._positionListener.stickyColumnsUpdated({
716
- sizes: lastStickyStart === -1
717
- ? []
718
- : cellWidths
719
- .slice(0, lastStickyStart + 1)
720
- .map((width, index) => (stickyStartStates[index] ? width : null)),
721
- });
722
- this._positionListener.stickyEndColumnsUpdated({
723
- sizes: firstStickyEnd === -1
724
- ? []
725
- : cellWidths
726
- .slice(firstStickyEnd)
727
- .map((width, index) => stickyEndStates[index + firstStickyEnd] ? width : null)
728
- .reverse(),
729
- });
730
- }
731
- },
732
- }, {
733
- injector: this._tableInjector,
734
- });
735
- }
736
- /**
737
- * Applies sticky positioning to the row's cells if using the native table layout, and to the
738
- * row itself otherwise.
739
- * @param rowsToStick The list of rows that should be stuck according to their corresponding
740
- * sticky state and to the provided top or bottom position.
741
- * @param stickyStates A list of boolean states where each state represents whether the row
742
- * should be stuck in the particular top or bottom position.
743
- * @param position The position direction in which the row should be stuck if that row should be
744
- * sticky.
745
- *
746
- */
747
- stickRows(rowsToStick, stickyStates, position) {
748
- // Since we can't measure the rows on the server, we can't stick the rows properly.
749
- if (!this._isBrowser) {
750
- return;
751
- }
752
- // If positioning the rows to the bottom, reverse their order when evaluating the sticky
753
- // position such that the last row stuck will be "bottom: 0px" and so on. Note that the
754
- // sticky states need to be reversed as well.
755
- const rows = position === 'bottom' ? rowsToStick.slice().reverse() : rowsToStick;
756
- const states = position === 'bottom' ? stickyStates.slice().reverse() : stickyStates;
757
- // Measure row heights all at once before adding sticky styles to reduce layout thrashing.
758
- const stickyOffsets = [];
759
- const stickyCellHeights = [];
760
- const elementsToStick = [];
761
- // Coalesce with other sticky row updates (top/bottom), sticky columns updates
762
- // (and potentially other changes like column resize).
763
- afterNextRender({
764
- earlyRead: () => {
765
- for (let rowIndex = 0, stickyOffset = 0; rowIndex < rows.length; rowIndex++) {
766
- if (!states[rowIndex]) {
767
- continue;
768
- }
769
- stickyOffsets[rowIndex] = stickyOffset;
770
- const row = rows[rowIndex];
771
- elementsToStick[rowIndex] = this._isNativeHtmlTable
772
- ? Array.from(row.children)
773
- : [row];
774
- const height = this._retrieveElementSize(row).height;
775
- stickyOffset += height;
776
- stickyCellHeights[rowIndex] = height;
777
- }
778
- },
779
- write: () => {
780
- const borderedRowIndex = states.lastIndexOf(true);
781
- for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
782
- if (!states[rowIndex]) {
783
- continue;
784
- }
785
- const offset = stickyOffsets[rowIndex];
786
- const isBorderedRowIndex = rowIndex === borderedRowIndex;
787
- for (const element of elementsToStick[rowIndex]) {
788
- this._addStickyStyle(element, position, offset, isBorderedRowIndex);
789
- }
790
- }
791
- if (position === 'top') {
792
- this._positionListener?.stickyHeaderRowsUpdated({
793
- sizes: stickyCellHeights,
794
- offsets: stickyOffsets,
795
- elements: elementsToStick,
796
- });
797
- }
798
- else {
799
- this._positionListener?.stickyFooterRowsUpdated({
800
- sizes: stickyCellHeights,
801
- offsets: stickyOffsets,
802
- elements: elementsToStick,
803
- });
804
- }
805
- },
806
- }, {
807
- injector: this._tableInjector,
808
- });
809
- }
810
- /**
811
- * When using the native table in Safari, sticky footer cells do not stick. The only way to stick
812
- * footer rows is to apply sticky styling to the tfoot container. This should only be done if
813
- * all footer rows are sticky. If not all footer rows are sticky, remove sticky positioning from
814
- * the tfoot element.
815
- */
816
- updateStickyFooterContainer(tableElement, stickyStates) {
817
- if (!this._isNativeHtmlTable) {
818
- return;
819
- }
820
- // Coalesce with other sticky updates (and potentially other changes like column resize).
821
- afterNextRender({
822
- write: () => {
823
- const tfoot = tableElement.querySelector('tfoot');
824
- if (tfoot) {
825
- if (stickyStates.some(state => !state)) {
826
- this._removeStickyStyle(tfoot, ['bottom']);
827
- }
828
- else {
829
- this._addStickyStyle(tfoot, 'bottom', 0, false);
830
- }
831
- }
832
- },
833
- }, {
834
- injector: this._tableInjector,
835
- });
836
- }
837
- /** Triggered by the table's OnDestroy hook. */
838
- destroy() {
839
- if (this._stickyColumnsReplayTimeout) {
840
- clearTimeout(this._stickyColumnsReplayTimeout);
841
- }
842
- this._resizeObserver?.disconnect();
843
- this._destroyed = true;
844
- }
845
- /**
846
- * Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating
847
- * the zIndex, removing each of the provided sticky directions, and removing the
848
- * sticky position if there are no more directions.
849
- */
850
- _removeStickyStyle(element, stickyDirections) {
851
- if (!element.classList.contains(this._stickCellCss)) {
852
- return;
853
- }
854
- for (const dir of stickyDirections) {
855
- element.style[dir] = '';
856
- element.classList.remove(this._borderCellCss[dir]);
857
- }
858
- // If the element no longer has any more sticky directions, remove sticky positioning and
859
- // the sticky CSS class.
860
- // Short-circuit checking element.style[dir] for stickyDirections as they
861
- // were already removed above.
862
- const hasDirection = STICKY_DIRECTIONS.some(dir => stickyDirections.indexOf(dir) === -1 && element.style[dir]);
863
- if (hasDirection) {
864
- element.style.zIndex = this._getCalculatedZIndex(element);
865
- }
866
- else {
867
- // When not hasDirection, _getCalculatedZIndex will always return ''.
868
- element.style.zIndex = '';
869
- if (this._needsPositionStickyOnElement) {
870
- element.style.position = '';
1000
+ if (stickyEndStates[i]) {
1001
+ this._addStickyStyle(cell, end, endPositions[i], i === firstStickyEnd);
871
1002
  }
872
- element.classList.remove(this._stickCellCss);
873
- }
874
- }
875
- /**
876
- * Adds the sticky styling to the element by adding the sticky style class, changing position
877
- * to be sticky (and -webkit-sticky), setting the appropriate zIndex, and adding a sticky
878
- * direction and value.
879
- */
880
- _addStickyStyle(element, dir, dirValue, isBorderElement) {
881
- element.classList.add(this._stickCellCss);
882
- if (isBorderElement) {
883
- element.classList.add(this._borderCellCss[dir]);
884
- }
885
- element.style[dir] = `${dirValue}px`;
886
- element.style.zIndex = this._getCalculatedZIndex(element);
887
- if (this._needsPositionStickyOnElement) {
888
- element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
889
- }
890
- }
891
- /**
892
- * Calculate what the z-index should be for the element, depending on what directions (top,
893
- * bottom, left, right) have been set. It should be true that elements with a top direction
894
- * should have the highest index since these are elements like a table header. If any of those
895
- * elements are also sticky in another direction, then they should appear above other elements
896
- * that are only sticky top (e.g. a sticky column on a sticky header). Bottom-sticky elements
897
- * (e.g. footer rows) should then be next in the ordering such that they are below the header
898
- * but above any non-sticky elements. Finally, left/right sticky elements (e.g. sticky columns)
899
- * should minimally increment so that they are above non-sticky elements but below top and bottom
900
- * elements.
901
- */
902
- _getCalculatedZIndex(element) {
903
- const zIndexIncrements = {
904
- top: 100,
905
- bottom: 10,
906
- left: 1,
907
- right: 1,
908
- };
909
- let zIndex = 0;
910
- // Use `Iterable` instead of `Array` because TypeScript, as of 3.6.3,
911
- // loses the array generic type in the `for of`. But we *also* have to use `Array` because
912
- // typescript won't iterate over an `Iterable` unless you compile with `--downlevelIteration`
913
- for (const dir of STICKY_DIRECTIONS) {
914
- if (element.style[dir]) {
915
- zIndex += zIndexIncrements[dir];
916
- }
917
- }
918
- return zIndex ? `${zIndex}` : '';
919
- }
920
- /** Gets the widths for each cell in the provided row. */
921
- _getCellWidths(row, recalculateCellWidths = true) {
922
- if (!recalculateCellWidths && this._cachedCellWidths.length) {
923
- return this._cachedCellWidths;
924
- }
925
- const cellWidths = [];
926
- const firstRowCells = row.children;
927
- for (let i = 0; i < firstRowCells.length; i++) {
928
- const cell = firstRowCells[i];
929
- cellWidths.push(this._retrieveElementSize(cell).width);
930
- }
931
- this._cachedCellWidths = cellWidths;
932
- return cellWidths;
933
- }
934
- /**
935
- * Determines the left and right positions of each sticky column cell, which will be the
936
- * accumulation of all sticky column cell widths to the left and right, respectively.
937
- * Non-sticky cells do not need to have a value set since their positions will not be applied.
938
- */
939
- _getStickyStartColumnPositions(widths, stickyStates) {
940
- const positions = [];
941
- let nextPosition = 0;
942
- for (let i = 0; i < widths.length; i++) {
943
- if (stickyStates[i]) {
944
- positions[i] = nextPosition;
945
- nextPosition += widths[i];
946
- }
947
- }
948
- return positions;
949
- }
950
- /**
951
- * Determines the left and right positions of each sticky column cell, which will be the
952
- * accumulation of all sticky column cell widths to the left and right, respectively.
953
- * Non-sticky cells do not need to have a value set since their positions will not be applied.
954
- */
955
- _getStickyEndColumnPositions(widths, stickyStates) {
956
- const positions = [];
957
- let nextPosition = 0;
958
- for (let i = widths.length; i > 0; i--) {
959
- if (stickyStates[i]) {
960
- positions[i] = nextPosition;
961
- nextPosition += widths[i];
962
- }
963
- }
964
- return positions;
965
- }
966
- /**
967
- * Retreives the most recently observed size of the specified element from the cache, or
968
- * meaures it directly if not yet cached.
969
- */
970
- _retrieveElementSize(element) {
971
- const cachedSize = this._elemSizeCache.get(element);
972
- if (cachedSize) {
973
- return cachedSize;
974
- }
975
- const clientRect = element.getBoundingClientRect();
976
- const size = { width: clientRect.width, height: clientRect.height };
977
- if (!this._resizeObserver) {
978
- return size;
979
- }
980
- this._elemSizeCache.set(element, size);
981
- this._resizeObserver.observe(element, { box: 'border-box' });
982
- return size;
983
- }
984
- /**
985
- * Conditionally enqueue the requested sticky update and clear previously queued updates
986
- * for the same rows.
987
- */
988
- _updateStickyColumnReplayQueue(params) {
989
- this._removeFromStickyColumnReplayQueue(params.rows);
990
- // No need to replay if a flush is pending.
991
- if (!this._stickyColumnsReplayTimeout) {
992
- this._updatedStickyColumnsParamsToReplay.push(params);
1003
+ }
1004
+ }
1005
+ if (this._positionListener && cellWidths.some(w => !!w)) {
1006
+ this._positionListener.stickyColumnsUpdated({
1007
+ sizes: lastStickyStart === -1 ? [] : cellWidths.slice(0, lastStickyStart + 1).map((width, index) => stickyStartStates[index] ? width : null)
1008
+ });
1009
+ this._positionListener.stickyEndColumnsUpdated({
1010
+ sizes: firstStickyEnd === -1 ? [] : cellWidths.slice(firstStickyEnd).map((width, index) => stickyEndStates[index + firstStickyEnd] ? width : null).reverse()
1011
+ });
1012
+ }
1013
+ }
1014
+ }, {
1015
+ injector: this._tableInjector
1016
+ });
1017
+ }
1018
+ stickRows(rowsToStick, stickyStates, position) {
1019
+ if (!this._isBrowser) {
1020
+ return;
1021
+ }
1022
+ const rows = position === 'bottom' ? rowsToStick.slice().reverse() : rowsToStick;
1023
+ const states = position === 'bottom' ? stickyStates.slice().reverse() : stickyStates;
1024
+ const stickyOffsets = [];
1025
+ const stickyCellHeights = [];
1026
+ const elementsToStick = [];
1027
+ afterNextRender({
1028
+ earlyRead: () => {
1029
+ for (let rowIndex = 0, stickyOffset = 0; rowIndex < rows.length; rowIndex++) {
1030
+ if (!states[rowIndex]) {
1031
+ continue;
1032
+ }
1033
+ stickyOffsets[rowIndex] = stickyOffset;
1034
+ const row = rows[rowIndex];
1035
+ elementsToStick[rowIndex] = this._isNativeHtmlTable ? Array.from(row.children) : [row];
1036
+ const height = this._retrieveElementSize(row).height;
1037
+ stickyOffset += height;
1038
+ stickyCellHeights[rowIndex] = height;
1039
+ }
1040
+ },
1041
+ write: () => {
1042
+ const borderedRowIndex = states.lastIndexOf(true);
1043
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1044
+ if (!states[rowIndex]) {
1045
+ continue;
1046
+ }
1047
+ const offset = stickyOffsets[rowIndex];
1048
+ const isBorderedRowIndex = rowIndex === borderedRowIndex;
1049
+ for (const element of elementsToStick[rowIndex]) {
1050
+ this._addStickyStyle(element, position, offset, isBorderedRowIndex);
1051
+ }
1052
+ }
1053
+ if (position === 'top') {
1054
+ this._positionListener?.stickyHeaderRowsUpdated({
1055
+ sizes: stickyCellHeights,
1056
+ offsets: stickyOffsets,
1057
+ elements: elementsToStick
1058
+ });
1059
+ } else {
1060
+ this._positionListener?.stickyFooterRowsUpdated({
1061
+ sizes: stickyCellHeights,
1062
+ offsets: stickyOffsets,
1063
+ elements: elementsToStick
1064
+ });
1065
+ }
1066
+ }
1067
+ }, {
1068
+ injector: this._tableInjector
1069
+ });
1070
+ }
1071
+ updateStickyFooterContainer(tableElement, stickyStates) {
1072
+ if (!this._isNativeHtmlTable) {
1073
+ return;
1074
+ }
1075
+ afterNextRender({
1076
+ write: () => {
1077
+ const tfoot = tableElement.querySelector('tfoot');
1078
+ if (tfoot) {
1079
+ if (stickyStates.some(state => !state)) {
1080
+ this._removeStickyStyle(tfoot, ['bottom']);
1081
+ } else {
1082
+ this._addStickyStyle(tfoot, 'bottom', 0, false);
1083
+ }
1084
+ }
1085
+ }
1086
+ }, {
1087
+ injector: this._tableInjector
1088
+ });
1089
+ }
1090
+ destroy() {
1091
+ if (this._stickyColumnsReplayTimeout) {
1092
+ clearTimeout(this._stickyColumnsReplayTimeout);
1093
+ }
1094
+ this._resizeObserver?.disconnect();
1095
+ this._destroyed = true;
1096
+ }
1097
+ _removeStickyStyle(element, stickyDirections) {
1098
+ if (!element.classList.contains(this._stickCellCss)) {
1099
+ return;
1100
+ }
1101
+ for (const dir of stickyDirections) {
1102
+ element.style[dir] = '';
1103
+ element.classList.remove(this._borderCellCss[dir]);
1104
+ }
1105
+ const hasDirection = STICKY_DIRECTIONS.some(dir => stickyDirections.indexOf(dir) === -1 && element.style[dir]);
1106
+ if (hasDirection) {
1107
+ element.style.zIndex = this._getCalculatedZIndex(element);
1108
+ } else {
1109
+ element.style.zIndex = '';
1110
+ if (this._needsPositionStickyOnElement) {
1111
+ element.style.position = '';
1112
+ }
1113
+ element.classList.remove(this._stickCellCss);
1114
+ }
1115
+ }
1116
+ _addStickyStyle(element, dir, dirValue, isBorderElement) {
1117
+ element.classList.add(this._stickCellCss);
1118
+ if (isBorderElement) {
1119
+ element.classList.add(this._borderCellCss[dir]);
1120
+ }
1121
+ element.style[dir] = `${dirValue}px`;
1122
+ element.style.zIndex = this._getCalculatedZIndex(element);
1123
+ if (this._needsPositionStickyOnElement) {
1124
+ element.style.cssText += 'position: -webkit-sticky; position: sticky; ';
1125
+ }
1126
+ }
1127
+ _getCalculatedZIndex(element) {
1128
+ const zIndexIncrements = {
1129
+ top: 100,
1130
+ bottom: 10,
1131
+ left: 1,
1132
+ right: 1
1133
+ };
1134
+ let zIndex = 0;
1135
+ for (const dir of STICKY_DIRECTIONS) {
1136
+ if (element.style[dir]) {
1137
+ zIndex += zIndexIncrements[dir];
1138
+ }
1139
+ }
1140
+ return zIndex ? `${zIndex}` : '';
1141
+ }
1142
+ _getCellWidths(row, recalculateCellWidths = true) {
1143
+ if (!recalculateCellWidths && this._cachedCellWidths.length) {
1144
+ return this._cachedCellWidths;
1145
+ }
1146
+ const cellWidths = [];
1147
+ const firstRowCells = row.children;
1148
+ for (let i = 0; i < firstRowCells.length; i++) {
1149
+ const cell = firstRowCells[i];
1150
+ cellWidths.push(this._retrieveElementSize(cell).width);
1151
+ }
1152
+ this._cachedCellWidths = cellWidths;
1153
+ return cellWidths;
1154
+ }
1155
+ _getStickyStartColumnPositions(widths, stickyStates) {
1156
+ const positions = [];
1157
+ let nextPosition = 0;
1158
+ for (let i = 0; i < widths.length; i++) {
1159
+ if (stickyStates[i]) {
1160
+ positions[i] = nextPosition;
1161
+ nextPosition += widths[i];
1162
+ }
1163
+ }
1164
+ return positions;
1165
+ }
1166
+ _getStickyEndColumnPositions(widths, stickyStates) {
1167
+ const positions = [];
1168
+ let nextPosition = 0;
1169
+ for (let i = widths.length; i > 0; i--) {
1170
+ if (stickyStates[i]) {
1171
+ positions[i] = nextPosition;
1172
+ nextPosition += widths[i];
1173
+ }
1174
+ }
1175
+ return positions;
1176
+ }
1177
+ _retrieveElementSize(element) {
1178
+ const cachedSize = this._elemSizeCache.get(element);
1179
+ if (cachedSize) {
1180
+ return cachedSize;
1181
+ }
1182
+ const clientRect = element.getBoundingClientRect();
1183
+ const size = {
1184
+ width: clientRect.width,
1185
+ height: clientRect.height
1186
+ };
1187
+ if (!this._resizeObserver) {
1188
+ return size;
1189
+ }
1190
+ this._elemSizeCache.set(element, size);
1191
+ this._resizeObserver.observe(element, {
1192
+ box: 'border-box'
1193
+ });
1194
+ return size;
1195
+ }
1196
+ _updateStickyColumnReplayQueue(params) {
1197
+ this._removeFromStickyColumnReplayQueue(params.rows);
1198
+ if (!this._stickyColumnsReplayTimeout) {
1199
+ this._updatedStickyColumnsParamsToReplay.push(params);
1200
+ }
1201
+ }
1202
+ _removeFromStickyColumnReplayQueue(rows) {
1203
+ const rowsSet = new Set(rows);
1204
+ for (const update of this._updatedStickyColumnsParamsToReplay) {
1205
+ update.rows = update.rows.filter(row => !rowsSet.has(row));
1206
+ }
1207
+ this._updatedStickyColumnsParamsToReplay = this._updatedStickyColumnsParamsToReplay.filter(update => !!update.rows.length);
1208
+ }
1209
+ _updateCachedSizes(entries) {
1210
+ let needsColumnUpdate = false;
1211
+ for (const entry of entries) {
1212
+ const newEntry = entry.borderBoxSize?.length ? {
1213
+ width: entry.borderBoxSize[0].inlineSize,
1214
+ height: entry.borderBoxSize[0].blockSize
1215
+ } : {
1216
+ width: entry.contentRect.width,
1217
+ height: entry.contentRect.height
1218
+ };
1219
+ if (newEntry.width !== this._elemSizeCache.get(entry.target)?.width && isCell(entry.target)) {
1220
+ needsColumnUpdate = true;
1221
+ }
1222
+ this._elemSizeCache.set(entry.target, newEntry);
1223
+ }
1224
+ if (needsColumnUpdate && this._updatedStickyColumnsParamsToReplay.length) {
1225
+ if (this._stickyColumnsReplayTimeout) {
1226
+ clearTimeout(this._stickyColumnsReplayTimeout);
1227
+ }
1228
+ this._stickyColumnsReplayTimeout = setTimeout(() => {
1229
+ if (this._destroyed) {
1230
+ return;
993
1231
  }
994
- }
995
- /** Remove updates for the specified rows from the queue. */
996
- _removeFromStickyColumnReplayQueue(rows) {
997
- const rowsSet = new Set(rows);
998
1232
  for (const update of this._updatedStickyColumnsParamsToReplay) {
999
- update.rows = update.rows.filter(row => !rowsSet.has(row));
1000
- }
1001
- this._updatedStickyColumnsParamsToReplay = this._updatedStickyColumnsParamsToReplay.filter(update => !!update.rows.length);
1002
- }
1003
- /** Update _elemSizeCache with the observed sizes. */
1004
- _updateCachedSizes(entries) {
1005
- let needsColumnUpdate = false;
1006
- for (const entry of entries) {
1007
- const newEntry = entry.borderBoxSize?.length
1008
- ? {
1009
- width: entry.borderBoxSize[0].inlineSize,
1010
- height: entry.borderBoxSize[0].blockSize,
1011
- }
1012
- : {
1013
- width: entry.contentRect.width,
1014
- height: entry.contentRect.height,
1015
- };
1016
- if (newEntry.width !== this._elemSizeCache.get(entry.target)?.width &&
1017
- isCell(entry.target)) {
1018
- needsColumnUpdate = true;
1019
- }
1020
- this._elemSizeCache.set(entry.target, newEntry);
1021
- }
1022
- if (needsColumnUpdate && this._updatedStickyColumnsParamsToReplay.length) {
1023
- if (this._stickyColumnsReplayTimeout) {
1024
- clearTimeout(this._stickyColumnsReplayTimeout);
1025
- }
1026
- this._stickyColumnsReplayTimeout = setTimeout(() => {
1027
- if (this._destroyed) {
1028
- return;
1029
- }
1030
- for (const update of this._updatedStickyColumnsParamsToReplay) {
1031
- this.updateStickyColumns(update.rows, update.stickyStartStates, update.stickyEndStates, true, false);
1032
- }
1033
- this._updatedStickyColumnsParamsToReplay = [];
1034
- this._stickyColumnsReplayTimeout = null;
1035
- }, 0);
1233
+ this.updateStickyColumns(update.rows, update.stickyStartStates, update.stickyEndStates, true, false);
1036
1234
  }
1235
+ this._updatedStickyColumnsParamsToReplay = [];
1236
+ this._stickyColumnsReplayTimeout = null;
1237
+ }, 0);
1037
1238
  }
1239
+ }
1038
1240
  }
1039
1241
  function isCell(element) {
1040
- return ['cdk-cell', 'cdk-header-cell', 'cdk-footer-cell'].some(klass => element.classList.contains(klass));
1242
+ return ['cdk-cell', 'cdk-header-cell', 'cdk-footer-cell'].some(klass => element.classList.contains(klass));
1041
1243
  }
1042
1244
 
1043
- /**
1044
- * Returns an error to be thrown when attempting to find an nonexistent column.
1045
- * @param id Id whose lookup failed.
1046
- * @docs-private
1047
- */
1048
1245
  function getTableUnknownColumnError(id) {
1049
- return Error(`Could not find column with id "${id}".`);
1246
+ return Error(`Could not find column with id "${id}".`);
1050
1247
  }
1051
- /**
1052
- * Returns an error to be thrown when two column definitions have the same name.
1053
- * @docs-private
1054
- */
1055
1248
  function getTableDuplicateColumnNameError(name) {
1056
- return Error(`Duplicate column definition name provided: "${name}".`);
1249
+ return Error(`Duplicate column definition name provided: "${name}".`);
1057
1250
  }
1058
- /**
1059
- * Returns an error to be thrown when there are multiple rows that are missing a when function.
1060
- * @docs-private
1061
- */
1062
1251
  function getTableMultipleDefaultRowDefsError() {
1063
- return Error(`There can only be one default row without a when predicate function. ` +
1064
- 'Or set `multiTemplateDataRows`.');
1252
+ return Error(`There can only be one default row without a when predicate function. ` + 'Or set `multiTemplateDataRows`.');
1065
1253
  }
1066
- /**
1067
- * Returns an error to be thrown when there are no matching row defs for a particular set of data.
1068
- * @docs-private
1069
- */
1070
1254
  function getTableMissingMatchingRowDefError(data) {
1071
- return Error(`Could not find a matching row definition for the ` +
1072
- `provided row data: ${JSON.stringify(data)}`);
1255
+ return Error(`Could not find a matching row definition for the ` + `provided row data: ${JSON.stringify(data)}`);
1073
1256
  }
1074
- /**
1075
- * Returns an error to be thrown when there is no row definitions present in the content.
1076
- * @docs-private
1077
- */
1078
1257
  function getTableMissingRowDefsError() {
1079
- return Error('Missing definitions for header, footer, and row; ' +
1080
- 'cannot determine which columns should be rendered.');
1258
+ return Error('Missing definitions for header, footer, and row; ' + 'cannot determine which columns should be rendered.');
1081
1259
  }
1082
- /**
1083
- * Returns an error to be thrown when the data source does not match the compatible types.
1084
- * @docs-private
1085
- */
1086
1260
  function getTableUnknownDataSourceError() {
1087
- return Error(`Provided data source did not match an array, Observable, or DataSource`);
1261
+ return Error(`Provided data source did not match an array, Observable, or DataSource`);
1088
1262
  }
1089
- /**
1090
- * Returns an error to be thrown when the text column cannot find a parent table to inject.
1091
- * @docs-private
1092
- */
1093
1263
  function getTableTextColumnMissingParentTableError() {
1094
- return Error(`Text column could not find a parent table for registration.`);
1264
+ return Error(`Text column could not find a parent table for registration.`);
1095
1265
  }
1096
- /**
1097
- * Returns an error to be thrown when a table text column doesn't have a name.
1098
- * @docs-private
1099
- */
1100
1266
  function getTableTextColumnMissingNameError() {
1101
- return Error(`Table text column must have a name.`);
1267
+ return Error(`Table text column must have a name.`);
1102
1268
  }
1103
1269
 
1104
- /** The injection token used to specify the StickyPositioningListener. */
1105
1270
  const STICKY_POSITIONING_LISTENER = new InjectionToken('CDK_SPL');
1106
1271
 
1107
- /**
1108
- * Enables the recycle view repeater strategy, which reduces rendering latency. Not compatible with
1109
- * tables that animate rows.
1110
- */
1111
1272
  class CdkRecycleRows {
1112
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRecycleRows, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1113
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkRecycleRows, isStandalone: true, selector: "cdk-table[recycleRows], table[cdk-table][recycleRows]", providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }], ngImport: i0 });
1273
+ static ɵfac = i0.ɵɵngDeclareFactory({
1274
+ minVersion: "12.0.0",
1275
+ version: "20.2.0-next.2",
1276
+ ngImport: i0,
1277
+ type: CdkRecycleRows,
1278
+ deps: [],
1279
+ target: i0.ɵɵFactoryTarget.Directive
1280
+ });
1281
+ static ɵdir = i0.ɵɵngDeclareDirective({
1282
+ minVersion: "14.0.0",
1283
+ version: "20.2.0-next.2",
1284
+ type: CdkRecycleRows,
1285
+ isStandalone: true,
1286
+ selector: "cdk-table[recycleRows], table[cdk-table][recycleRows]",
1287
+ providers: [{
1288
+ provide: _VIEW_REPEATER_STRATEGY,
1289
+ useClass: _RecycleViewRepeaterStrategy
1290
+ }],
1291
+ ngImport: i0
1292
+ });
1114
1293
  }
1115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkRecycleRows, decorators: [{
1116
- type: Directive,
1117
- args: [{
1118
- selector: 'cdk-table[recycleRows], table[cdk-table][recycleRows]',
1119
- providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }],
1120
- }]
1121
- }] });
1122
- /**
1123
- * Provides a handle for the table to grab the view container's ng-container to insert data rows.
1124
- * @docs-private
1125
- */
1294
+ i0.ɵɵngDeclareClassMetadata({
1295
+ minVersion: "12.0.0",
1296
+ version: "20.2.0-next.2",
1297
+ ngImport: i0,
1298
+ type: CdkRecycleRows,
1299
+ decorators: [{
1300
+ type: Directive,
1301
+ args: [{
1302
+ selector: 'cdk-table[recycleRows], table[cdk-table][recycleRows]',
1303
+ providers: [{
1304
+ provide: _VIEW_REPEATER_STRATEGY,
1305
+ useClass: _RecycleViewRepeaterStrategy
1306
+ }]
1307
+ }]
1308
+ }]
1309
+ });
1126
1310
  class DataRowOutlet {
1127
- viewContainer = inject(ViewContainerRef);
1128
- elementRef = inject(ElementRef);
1129
- constructor() {
1130
- const table = inject(CDK_TABLE);
1131
- table._rowOutlet = this;
1132
- table._outletAssigned();
1133
- }
1134
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DataRowOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1135
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: DataRowOutlet, isStandalone: true, selector: "[rowOutlet]", ngImport: i0 });
1311
+ viewContainer = inject(ViewContainerRef);
1312
+ elementRef = inject(ElementRef);
1313
+ constructor() {
1314
+ const table = inject(CDK_TABLE);
1315
+ table._rowOutlet = this;
1316
+ table._outletAssigned();
1317
+ }
1318
+ static ɵfac = i0.ɵɵngDeclareFactory({
1319
+ minVersion: "12.0.0",
1320
+ version: "20.2.0-next.2",
1321
+ ngImport: i0,
1322
+ type: DataRowOutlet,
1323
+ deps: [],
1324
+ target: i0.ɵɵFactoryTarget.Directive
1325
+ });
1326
+ static ɵdir = i0.ɵɵngDeclareDirective({
1327
+ minVersion: "14.0.0",
1328
+ version: "20.2.0-next.2",
1329
+ type: DataRowOutlet,
1330
+ isStandalone: true,
1331
+ selector: "[rowOutlet]",
1332
+ ngImport: i0
1333
+ });
1136
1334
  }
1137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DataRowOutlet, decorators: [{
1138
- type: Directive,
1139
- args: [{
1140
- selector: '[rowOutlet]',
1141
- }]
1142
- }], ctorParameters: () => [] });
1143
- /**
1144
- * Provides a handle for the table to grab the view container's ng-container to insert the header.
1145
- * @docs-private
1146
- */
1335
+ i0.ɵɵngDeclareClassMetadata({
1336
+ minVersion: "12.0.0",
1337
+ version: "20.2.0-next.2",
1338
+ ngImport: i0,
1339
+ type: DataRowOutlet,
1340
+ decorators: [{
1341
+ type: Directive,
1342
+ args: [{
1343
+ selector: '[rowOutlet]'
1344
+ }]
1345
+ }],
1346
+ ctorParameters: () => []
1347
+ });
1147
1348
  class HeaderRowOutlet {
1148
- viewContainer = inject(ViewContainerRef);
1149
- elementRef = inject(ElementRef);
1150
- constructor() {
1151
- const table = inject(CDK_TABLE);
1152
- table._headerRowOutlet = this;
1153
- table._outletAssigned();
1154
- }
1155
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: HeaderRowOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1156
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: HeaderRowOutlet, isStandalone: true, selector: "[headerRowOutlet]", ngImport: i0 });
1349
+ viewContainer = inject(ViewContainerRef);
1350
+ elementRef = inject(ElementRef);
1351
+ constructor() {
1352
+ const table = inject(CDK_TABLE);
1353
+ table._headerRowOutlet = this;
1354
+ table._outletAssigned();
1355
+ }
1356
+ static ɵfac = i0.ɵɵngDeclareFactory({
1357
+ minVersion: "12.0.0",
1358
+ version: "20.2.0-next.2",
1359
+ ngImport: i0,
1360
+ type: HeaderRowOutlet,
1361
+ deps: [],
1362
+ target: i0.ɵɵFactoryTarget.Directive
1363
+ });
1364
+ static ɵdir = i0.ɵɵngDeclareDirective({
1365
+ minVersion: "14.0.0",
1366
+ version: "20.2.0-next.2",
1367
+ type: HeaderRowOutlet,
1368
+ isStandalone: true,
1369
+ selector: "[headerRowOutlet]",
1370
+ ngImport: i0
1371
+ });
1157
1372
  }
1158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: HeaderRowOutlet, decorators: [{
1159
- type: Directive,
1160
- args: [{
1161
- selector: '[headerRowOutlet]',
1162
- }]
1163
- }], ctorParameters: () => [] });
1164
- /**
1165
- * Provides a handle for the table to grab the view container's ng-container to insert the footer.
1166
- * @docs-private
1167
- */
1373
+ i0.ɵɵngDeclareClassMetadata({
1374
+ minVersion: "12.0.0",
1375
+ version: "20.2.0-next.2",
1376
+ ngImport: i0,
1377
+ type: HeaderRowOutlet,
1378
+ decorators: [{
1379
+ type: Directive,
1380
+ args: [{
1381
+ selector: '[headerRowOutlet]'
1382
+ }]
1383
+ }],
1384
+ ctorParameters: () => []
1385
+ });
1168
1386
  class FooterRowOutlet {
1169
- viewContainer = inject(ViewContainerRef);
1170
- elementRef = inject(ElementRef);
1171
- constructor() {
1172
- const table = inject(CDK_TABLE);
1173
- table._footerRowOutlet = this;
1174
- table._outletAssigned();
1175
- }
1176
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: FooterRowOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1177
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: FooterRowOutlet, isStandalone: true, selector: "[footerRowOutlet]", ngImport: i0 });
1387
+ viewContainer = inject(ViewContainerRef);
1388
+ elementRef = inject(ElementRef);
1389
+ constructor() {
1390
+ const table = inject(CDK_TABLE);
1391
+ table._footerRowOutlet = this;
1392
+ table._outletAssigned();
1393
+ }
1394
+ static ɵfac = i0.ɵɵngDeclareFactory({
1395
+ minVersion: "12.0.0",
1396
+ version: "20.2.0-next.2",
1397
+ ngImport: i0,
1398
+ type: FooterRowOutlet,
1399
+ deps: [],
1400
+ target: i0.ɵɵFactoryTarget.Directive
1401
+ });
1402
+ static ɵdir = i0.ɵɵngDeclareDirective({
1403
+ minVersion: "14.0.0",
1404
+ version: "20.2.0-next.2",
1405
+ type: FooterRowOutlet,
1406
+ isStandalone: true,
1407
+ selector: "[footerRowOutlet]",
1408
+ ngImport: i0
1409
+ });
1178
1410
  }
1179
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: FooterRowOutlet, decorators: [{
1180
- type: Directive,
1181
- args: [{
1182
- selector: '[footerRowOutlet]',
1183
- }]
1184
- }], ctorParameters: () => [] });
1185
- /**
1186
- * Provides a handle for the table to grab the view
1187
- * container's ng-container to insert the no data row.
1188
- * @docs-private
1189
- */
1411
+ i0.ɵɵngDeclareClassMetadata({
1412
+ minVersion: "12.0.0",
1413
+ version: "20.2.0-next.2",
1414
+ ngImport: i0,
1415
+ type: FooterRowOutlet,
1416
+ decorators: [{
1417
+ type: Directive,
1418
+ args: [{
1419
+ selector: '[footerRowOutlet]'
1420
+ }]
1421
+ }],
1422
+ ctorParameters: () => []
1423
+ });
1190
1424
  class NoDataRowOutlet {
1191
- viewContainer = inject(ViewContainerRef);
1192
- elementRef = inject(ElementRef);
1193
- constructor() {
1194
- const table = inject(CDK_TABLE);
1195
- table._noDataRowOutlet = this;
1196
- table._outletAssigned();
1197
- }
1198
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: NoDataRowOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1199
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: NoDataRowOutlet, isStandalone: true, selector: "[noDataRowOutlet]", ngImport: i0 });
1425
+ viewContainer = inject(ViewContainerRef);
1426
+ elementRef = inject(ElementRef);
1427
+ constructor() {
1428
+ const table = inject(CDK_TABLE);
1429
+ table._noDataRowOutlet = this;
1430
+ table._outletAssigned();
1431
+ }
1432
+ static ɵfac = i0.ɵɵngDeclareFactory({
1433
+ minVersion: "12.0.0",
1434
+ version: "20.2.0-next.2",
1435
+ ngImport: i0,
1436
+ type: NoDataRowOutlet,
1437
+ deps: [],
1438
+ target: i0.ɵɵFactoryTarget.Directive
1439
+ });
1440
+ static ɵdir = i0.ɵɵngDeclareDirective({
1441
+ minVersion: "14.0.0",
1442
+ version: "20.2.0-next.2",
1443
+ type: NoDataRowOutlet,
1444
+ isStandalone: true,
1445
+ selector: "[noDataRowOutlet]",
1446
+ ngImport: i0
1447
+ });
1200
1448
  }
1201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: NoDataRowOutlet, decorators: [{
1202
- type: Directive,
1203
- args: [{
1204
- selector: '[noDataRowOutlet]',
1205
- }]
1206
- }], ctorParameters: () => [] });
1207
- /**
1208
- * A data table that can render a header row, data rows, and a footer row.
1209
- * Uses the dataSource input to determine the data to be rendered. The data can be provided either
1210
- * as a data array, an Observable stream that emits the data array to render, or a DataSource with a
1211
- * connect function that will return an Observable stream that emits the data array to render.
1212
- */
1449
+ i0.ɵɵngDeclareClassMetadata({
1450
+ minVersion: "12.0.0",
1451
+ version: "20.2.0-next.2",
1452
+ ngImport: i0,
1453
+ type: NoDataRowOutlet,
1454
+ decorators: [{
1455
+ type: Directive,
1456
+ args: [{
1457
+ selector: '[noDataRowOutlet]'
1458
+ }]
1459
+ }],
1460
+ ctorParameters: () => []
1461
+ });
1213
1462
  class CdkTable {
1214
- _differs = inject(IterableDiffers);
1215
- _changeDetectorRef = inject(ChangeDetectorRef);
1216
- _elementRef = inject(ElementRef);
1217
- _dir = inject(Directionality, { optional: true });
1218
- _platform = inject(Platform);
1219
- _viewRepeater = inject(_VIEW_REPEATER_STRATEGY);
1220
- _viewportRuler = inject(ViewportRuler);
1221
- _stickyPositioningListener = inject(STICKY_POSITIONING_LISTENER, { optional: true, skipSelf: true });
1222
- _document = inject(DOCUMENT);
1223
- /** Latest data provided by the data source. */
1224
- _data;
1225
- /** Subject that emits when the component has been destroyed. */
1226
- _onDestroy = new Subject();
1227
- /** List of the rendered rows as identified by their `RenderRow` object. */
1228
- _renderRows;
1229
- /** Subscription that listens for the data provided by the data source. */
1230
- _renderChangeSubscription;
1231
- /**
1232
- * Map of all the user's defined columns (header, data, and footer cell template) identified by
1233
- * name. Collection populated by the column definitions gathered by `ContentChildren` as well as
1234
- * any custom column definitions added to `_customColumnDefs`.
1235
- */
1236
- _columnDefsByName = new Map();
1237
- /**
1238
- * Set of all row definitions that can be used by this table. Populated by the rows gathered by
1239
- * using `ContentChildren` as well as any custom row definitions added to `_customRowDefs`.
1240
- */
1241
- _rowDefs;
1242
- /**
1243
- * Set of all header row definitions that can be used by this table. Populated by the rows
1244
- * gathered by using `ContentChildren` as well as any custom row definitions added to
1245
- * `_customHeaderRowDefs`.
1246
- */
1247
- _headerRowDefs;
1248
- /**
1249
- * Set of all row definitions that can be used by this table. Populated by the rows gathered by
1250
- * using `ContentChildren` as well as any custom row definitions added to
1251
- * `_customFooterRowDefs`.
1252
- */
1253
- _footerRowDefs;
1254
- /** Differ used to find the changes in the data provided by the data source. */
1255
- _dataDiffer;
1256
- /** Stores the row definition that does not have a when predicate. */
1257
- _defaultRowDef;
1258
- /**
1259
- * Column definitions that were defined outside of the direct content children of the table.
1260
- * These will be defined when, e.g., creating a wrapper around the cdkTable that has
1261
- * column definitions as *its* content child.
1262
- */
1263
- _customColumnDefs = new Set();
1264
- /**
1265
- * Data row definitions that were defined outside of the direct content children of the table.
1266
- * These will be defined when, e.g., creating a wrapper around the cdkTable that has
1267
- * built-in data rows as *its* content child.
1268
- */
1269
- _customRowDefs = new Set();
1270
- /**
1271
- * Header row definitions that were defined outside of the direct content children of the table.
1272
- * These will be defined when, e.g., creating a wrapper around the cdkTable that has
1273
- * built-in header rows as *its* content child.
1274
- */
1275
- _customHeaderRowDefs = new Set();
1276
- /**
1277
- * Footer row definitions that were defined outside of the direct content children of the table.
1278
- * These will be defined when, e.g., creating a wrapper around the cdkTable that has a
1279
- * built-in footer row as *its* content child.
1280
- */
1281
- _customFooterRowDefs = new Set();
1282
- /** No data row that was defined outside of the direct content children of the table. */
1283
- _customNoDataRow;
1284
- /**
1285
- * Whether the header row definition has been changed. Triggers an update to the header row after
1286
- * content is checked. Initialized as true so that the table renders the initial set of rows.
1287
- */
1288
- _headerRowDefChanged = true;
1289
- /**
1290
- * Whether the footer row definition has been changed. Triggers an update to the footer row after
1291
- * content is checked. Initialized as true so that the table renders the initial set of rows.
1292
- */
1293
- _footerRowDefChanged = true;
1294
- /**
1295
- * Whether the sticky column styles need to be updated. Set to `true` when the visible columns
1296
- * change.
1297
- */
1298
- _stickyColumnStylesNeedReset = true;
1299
- /**
1300
- * Whether the sticky styler should recalculate cell widths when applying sticky styles. If
1301
- * `false`, cached values will be used instead. This is only applicable to tables with
1302
- * `_fixedLayout` enabled. For other tables, cell widths will always be recalculated.
1303
- */
1304
- _forceRecalculateCellWidths = true;
1305
- /**
1306
- * Cache of the latest rendered `RenderRow` objects as a map for easy retrieval when constructing
1307
- * a new list of `RenderRow` objects for rendering rows. Since the new list is constructed with
1308
- * the cached `RenderRow` objects when possible, the row identity is preserved when the data
1309
- * and row template matches, which allows the `IterableDiffer` to check rows by reference
1310
- * and understand which rows are added/moved/removed.
1311
- *
1312
- * Implemented as a map of maps where the first key is the `data: T` object and the second is the
1313
- * `CdkRowDef<T>` object. With the two keys, the cache points to a `RenderRow<T>` object that
1314
- * contains an array of created pairs. The array is necessary to handle cases where the data
1315
- * array contains multiple duplicate data objects and each instantiated `RenderRow` must be
1316
- * stored.
1317
- */
1318
- _cachedRenderRowsMap = new Map();
1319
- /** Whether the table is applied to a native `<table>`. */
1320
- _isNativeHtmlTable;
1321
- /**
1322
- * Utility class that is responsible for applying the appropriate sticky positioning styles to
1323
- * the table's rows and cells.
1324
- */
1325
- _stickyStyler;
1326
- /**
1327
- * CSS class added to any row or cell that has sticky positioning applied. May be overridden by
1328
- * table subclasses.
1329
- */
1330
- stickyCssClass = 'cdk-table-sticky';
1331
- /**
1332
- * Whether to manually add position: sticky to all sticky cell elements. Not needed if
1333
- * the position is set in a selector associated with the value of stickyCssClass. May be
1334
- * overridden by table subclasses
1335
- */
1336
- needsPositionStickyOnElement = true;
1337
- /** Whether the component is being rendered on the server. */
1338
- _isServer;
1339
- /** Whether the no data row is currently showing anything. */
1340
- _isShowingNoDataRow = false;
1341
- /** Whether the table has rendered out all the outlets for the first time. */
1342
- _hasAllOutlets = false;
1343
- /** Whether the table is done initializing. */
1344
- _hasInitialized = false;
1345
- /** Aria role to apply to the table's cells based on the table's own role. */
1346
- _getCellRole() {
1347
- // Perform this lazily in case the table's role was updated by a directive after construction.
1348
- if (this._cellRoleInternal === undefined) {
1349
- // Note that we set `role="cell"` even on native `td` elements,
1350
- // because some browsers seem to require it. See #29784.
1351
- const tableRole = this._elementRef.nativeElement.getAttribute('role');
1352
- return tableRole === 'grid' || tableRole === 'treegrid' ? 'gridcell' : 'cell';
1353
- }
1354
- return this._cellRoleInternal;
1355
- }
1356
- _cellRoleInternal = undefined;
1357
- /**
1358
- * Tracking function that will be used to check the differences in data changes. Used similarly
1359
- * to `ngFor` `trackBy` function. Optimize row operations by identifying a row based on its data
1360
- * relative to the function to know if a row should be added/removed/moved.
1361
- * Accepts a function that takes two parameters, `index` and `item`.
1362
- */
1363
- get trackBy() {
1364
- return this._trackByFn;
1365
- }
1366
- set trackBy(fn) {
1367
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && fn != null && typeof fn !== 'function') {
1368
- console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}.`);
1369
- }
1370
- this._trackByFn = fn;
1371
- }
1372
- _trackByFn;
1373
- /**
1374
- * The table's source of data, which can be provided in three ways (in order of complexity):
1375
- * - Simple data array (each object represents one table row)
1376
- * - Stream that emits a data array each time the array changes
1377
- * - `DataSource` object that implements the connect/disconnect interface.
1378
- *
1379
- * If a data array is provided, the table must be notified when the array's objects are
1380
- * added, removed, or moved. This can be done by calling the `renderRows()` function which will
1381
- * render the diff since the last table render. If the data array reference is changed, the table
1382
- * will automatically trigger an update to the rows.
1383
- *
1384
- * When providing an Observable stream, the table will trigger an update automatically when the
1385
- * stream emits a new array of data.
1386
- *
1387
- * Finally, when providing a `DataSource` object, the table will use the Observable stream
1388
- * provided by the connect function and trigger updates when that stream emits new data array
1389
- * values. During the table's ngOnDestroy or when the data source is removed from the table, the
1390
- * table will call the DataSource's `disconnect` function (may be useful for cleaning up any
1391
- * subscriptions registered during the connect process).
1392
- */
1393
- get dataSource() {
1394
- return this._dataSource;
1395
- }
1396
- set dataSource(dataSource) {
1397
- if (this._dataSource !== dataSource) {
1398
- this._switchDataSource(dataSource);
1399
- }
1400
- }
1401
- _dataSource;
1402
- /**
1403
- * Whether to allow multiple rows per data object by evaluating which rows evaluate their 'when'
1404
- * predicate to true. If `multiTemplateDataRows` is false, which is the default value, then each
1405
- * dataobject will render the first row that evaluates its when predicate to true, in the order
1406
- * defined in the table, or otherwise the default row which does not have a when predicate.
1407
- */
1408
- get multiTemplateDataRows() {
1409
- return this._multiTemplateDataRows;
1410
- }
1411
- set multiTemplateDataRows(value) {
1412
- this._multiTemplateDataRows = value;
1413
- // In Ivy if this value is set via a static attribute (e.g. <table multiTemplateDataRows>),
1414
- // this setter will be invoked before the row outlet has been defined hence the null check.
1415
- if (this._rowOutlet && this._rowOutlet.viewContainer.length) {
1416
- this._forceRenderDataRows();
1417
- this.updateStickyColumnStyles();
1418
- }
1419
- }
1420
- _multiTemplateDataRows = false;
1421
- /**
1422
- * Whether to use a fixed table layout. Enabling this option will enforce consistent column widths
1423
- * and optimize rendering sticky styles for native tables. No-op for flex tables.
1424
- */
1425
- get fixedLayout() {
1426
- return this._fixedLayout;
1427
- }
1428
- set fixedLayout(value) {
1429
- this._fixedLayout = value;
1430
- // Toggling `fixedLayout` may change column widths. Sticky column styles should be recalculated.
1431
- this._forceRecalculateCellWidths = true;
1432
- this._stickyColumnStylesNeedReset = true;
1433
- }
1434
- _fixedLayout = false;
1435
- /**
1436
- * Emits when the table completes rendering a set of data rows based on the latest data from the
1437
- * data source, even if the set of rows is empty.
1438
- */
1439
- contentChanged = new EventEmitter();
1440
- // TODO(andrewseguin): Remove max value as the end index
1441
- // and instead calculate the view on init and scroll.
1442
- /**
1443
- * Stream containing the latest information on what rows are being displayed on screen.
1444
- * Can be used by the data source to as a heuristic of what data should be provided.
1445
- *
1446
- * @docs-private
1447
- */
1448
- viewChange = new BehaviorSubject({
1449
- start: 0,
1450
- end: Number.MAX_VALUE,
1463
+ _differs = inject(IterableDiffers);
1464
+ _changeDetectorRef = inject(ChangeDetectorRef);
1465
+ _elementRef = inject(ElementRef);
1466
+ _dir = inject(Directionality, {
1467
+ optional: true
1468
+ });
1469
+ _platform = inject(Platform);
1470
+ _viewRepeater = inject(_VIEW_REPEATER_STRATEGY);
1471
+ _viewportRuler = inject(ViewportRuler);
1472
+ _stickyPositioningListener = inject(STICKY_POSITIONING_LISTENER, {
1473
+ optional: true,
1474
+ skipSelf: true
1475
+ });
1476
+ _document = inject(DOCUMENT);
1477
+ _data;
1478
+ _onDestroy = new Subject();
1479
+ _renderRows;
1480
+ _renderChangeSubscription;
1481
+ _columnDefsByName = new Map();
1482
+ _rowDefs;
1483
+ _headerRowDefs;
1484
+ _footerRowDefs;
1485
+ _dataDiffer;
1486
+ _defaultRowDef;
1487
+ _customColumnDefs = new Set();
1488
+ _customRowDefs = new Set();
1489
+ _customHeaderRowDefs = new Set();
1490
+ _customFooterRowDefs = new Set();
1491
+ _customNoDataRow;
1492
+ _headerRowDefChanged = true;
1493
+ _footerRowDefChanged = true;
1494
+ _stickyColumnStylesNeedReset = true;
1495
+ _forceRecalculateCellWidths = true;
1496
+ _cachedRenderRowsMap = new Map();
1497
+ _isNativeHtmlTable;
1498
+ _stickyStyler;
1499
+ stickyCssClass = 'cdk-table-sticky';
1500
+ needsPositionStickyOnElement = true;
1501
+ _isServer;
1502
+ _isShowingNoDataRow = false;
1503
+ _hasAllOutlets = false;
1504
+ _hasInitialized = false;
1505
+ _getCellRole() {
1506
+ if (this._cellRoleInternal === undefined) {
1507
+ const tableRole = this._elementRef.nativeElement.getAttribute('role');
1508
+ return tableRole === 'grid' || tableRole === 'treegrid' ? 'gridcell' : 'cell';
1509
+ }
1510
+ return this._cellRoleInternal;
1511
+ }
1512
+ _cellRoleInternal = undefined;
1513
+ get trackBy() {
1514
+ return this._trackByFn;
1515
+ }
1516
+ set trackBy(fn) {
1517
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && fn != null && typeof fn !== 'function') {
1518
+ console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}.`);
1519
+ }
1520
+ this._trackByFn = fn;
1521
+ }
1522
+ _trackByFn;
1523
+ get dataSource() {
1524
+ return this._dataSource;
1525
+ }
1526
+ set dataSource(dataSource) {
1527
+ if (this._dataSource !== dataSource) {
1528
+ this._switchDataSource(dataSource);
1529
+ }
1530
+ }
1531
+ _dataSource;
1532
+ get multiTemplateDataRows() {
1533
+ return this._multiTemplateDataRows;
1534
+ }
1535
+ set multiTemplateDataRows(value) {
1536
+ this._multiTemplateDataRows = value;
1537
+ if (this._rowOutlet && this._rowOutlet.viewContainer.length) {
1538
+ this._forceRenderDataRows();
1539
+ this.updateStickyColumnStyles();
1540
+ }
1541
+ }
1542
+ _multiTemplateDataRows = false;
1543
+ get fixedLayout() {
1544
+ return this._fixedLayout;
1545
+ }
1546
+ set fixedLayout(value) {
1547
+ this._fixedLayout = value;
1548
+ this._forceRecalculateCellWidths = true;
1549
+ this._stickyColumnStylesNeedReset = true;
1550
+ }
1551
+ _fixedLayout = false;
1552
+ contentChanged = new EventEmitter();
1553
+ viewChange = new BehaviorSubject({
1554
+ start: 0,
1555
+ end: Number.MAX_VALUE
1556
+ });
1557
+ _rowOutlet;
1558
+ _headerRowOutlet;
1559
+ _footerRowOutlet;
1560
+ _noDataRowOutlet;
1561
+ _contentColumnDefs;
1562
+ _contentRowDefs;
1563
+ _contentHeaderRowDefs;
1564
+ _contentFooterRowDefs;
1565
+ _noDataRow;
1566
+ _injector = inject(Injector);
1567
+ constructor() {
1568
+ const role = inject(new HostAttributeToken('role'), {
1569
+ optional: true
1451
1570
  });
1452
- // Outlets in the table's template where the header, data rows, and footer will be inserted.
1453
- _rowOutlet;
1454
- _headerRowOutlet;
1455
- _footerRowOutlet;
1456
- _noDataRowOutlet;
1457
- /**
1458
- * The column definitions provided by the user that contain what the header, data, and footer
1459
- * cells should render for each column.
1460
- */
1461
- _contentColumnDefs;
1462
- /** Set of data row definitions that were provided to the table as content children. */
1463
- _contentRowDefs;
1464
- /** Set of header row definitions that were provided to the table as content children. */
1465
- _contentHeaderRowDefs;
1466
- /** Set of footer row definitions that were provided to the table as content children. */
1467
- _contentFooterRowDefs;
1468
- /** Row definition that will only be rendered if there's no data in the table. */
1469
- _noDataRow;
1470
- _injector = inject(Injector);
1471
- constructor() {
1472
- const role = inject(new HostAttributeToken('role'), { optional: true });
1473
- if (!role) {
1474
- this._elementRef.nativeElement.setAttribute('role', 'table');
1475
- }
1476
- this._isServer = !this._platform.isBrowser;
1477
- this._isNativeHtmlTable = this._elementRef.nativeElement.nodeName === 'TABLE';
1478
- // Set up the trackBy function so that it uses the `RenderRow` as its identity by default. If
1479
- // the user has provided a custom trackBy, return the result of that function as evaluated
1480
- // with the values of the `RenderRow`'s data and index.
1481
- this._dataDiffer = this._differs.find([]).create((_i, dataRow) => {
1482
- return this.trackBy ? this.trackBy(dataRow.dataIndex, dataRow.data) : dataRow;
1483
- });
1484
- }
1485
- ngOnInit() {
1486
- this._setupStickyStyler();
1487
- this._viewportRuler
1488
- .change()
1489
- .pipe(takeUntil(this._onDestroy))
1490
- .subscribe(() => {
1491
- this._forceRecalculateCellWidths = true;
1492
- });
1493
- }
1494
- ngAfterContentInit() {
1495
- this._hasInitialized = true;
1496
- }
1497
- ngAfterContentChecked() {
1498
- // Only start re-rendering in `ngAfterContentChecked` after the first render.
1499
- if (this._canRender()) {
1500
- this._render();
1501
- }
1502
- }
1503
- ngOnDestroy() {
1504
- this._stickyStyler?.destroy();
1505
- [
1506
- this._rowOutlet?.viewContainer,
1507
- this._headerRowOutlet?.viewContainer,
1508
- this._footerRowOutlet?.viewContainer,
1509
- this._cachedRenderRowsMap,
1510
- this._customColumnDefs,
1511
- this._customRowDefs,
1512
- this._customHeaderRowDefs,
1513
- this._customFooterRowDefs,
1514
- this._columnDefsByName,
1515
- ].forEach((def) => {
1516
- def?.clear();
1517
- });
1518
- this._headerRowDefs = [];
1519
- this._footerRowDefs = [];
1520
- this._defaultRowDef = null;
1521
- this._onDestroy.next();
1522
- this._onDestroy.complete();
1523
- if (isDataSource(this.dataSource)) {
1524
- this.dataSource.disconnect(this);
1525
- }
1571
+ if (!role) {
1572
+ this._elementRef.nativeElement.setAttribute('role', 'table');
1526
1573
  }
1527
- /**
1528
- * Renders rows based on the table's latest set of data, which was either provided directly as an
1529
- * input or retrieved through an Observable stream (directly or from a DataSource).
1530
- * Checks for differences in the data since the last diff to perform only the necessary
1531
- * changes (add/remove/move rows).
1532
- *
1533
- * If the table's data source is a DataSource or Observable, this will be invoked automatically
1534
- * each time the provided Observable stream emits a new data array. Otherwise if your data is
1535
- * an array, this function will need to be called to render any changes.
1536
- */
1537
- renderRows() {
1538
- this._renderRows = this._getAllRenderRows();
1539
- const changes = this._dataDiffer.diff(this._renderRows);
1540
- if (!changes) {
1541
- this._updateNoDataRow();
1542
- this.contentChanged.next();
1543
- return;
1544
- }
1545
- const viewContainer = this._rowOutlet.viewContainer;
1546
- this._viewRepeater.applyChanges(changes, viewContainer, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record.item, currentIndex), record => record.item.data, (change) => {
1547
- if (change.operation === _ViewRepeaterOperation.INSERTED && change.context) {
1548
- this._renderCellTemplateForItem(change.record.item.rowDef, change.context);
1549
- }
1550
- });
1551
- // Update the meta context of a row's context data (index, count, first, last, ...)
1552
- this._updateRowIndexContext();
1553
- // Update rows that did not get added/removed/moved but may have had their identity changed,
1554
- // e.g. if trackBy matched data on some property but the actual data reference changed.
1555
- changes.forEachIdentityChange((record) => {
1556
- const rowView = viewContainer.get(record.currentIndex);
1557
- rowView.context.$implicit = record.item.data;
1558
- });
1559
- this._updateNoDataRow();
1560
- this.contentChanged.next();
1561
- this.updateStickyColumnStyles();
1562
- }
1563
- /** Adds a column definition that was not included as part of the content children. */
1564
- addColumnDef(columnDef) {
1565
- this._customColumnDefs.add(columnDef);
1566
- }
1567
- /** Removes a column definition that was not included as part of the content children. */
1568
- removeColumnDef(columnDef) {
1569
- this._customColumnDefs.delete(columnDef);
1570
- }
1571
- /** Adds a row definition that was not included as part of the content children. */
1572
- addRowDef(rowDef) {
1573
- this._customRowDefs.add(rowDef);
1574
- }
1575
- /** Removes a row definition that was not included as part of the content children. */
1576
- removeRowDef(rowDef) {
1577
- this._customRowDefs.delete(rowDef);
1578
- }
1579
- /** Adds a header row definition that was not included as part of the content children. */
1580
- addHeaderRowDef(headerRowDef) {
1581
- this._customHeaderRowDefs.add(headerRowDef);
1582
- this._headerRowDefChanged = true;
1583
- }
1584
- /** Removes a header row definition that was not included as part of the content children. */
1585
- removeHeaderRowDef(headerRowDef) {
1586
- this._customHeaderRowDefs.delete(headerRowDef);
1587
- this._headerRowDefChanged = true;
1588
- }
1589
- /** Adds a footer row definition that was not included as part of the content children. */
1590
- addFooterRowDef(footerRowDef) {
1591
- this._customFooterRowDefs.add(footerRowDef);
1592
- this._footerRowDefChanged = true;
1593
- }
1594
- /** Removes a footer row definition that was not included as part of the content children. */
1595
- removeFooterRowDef(footerRowDef) {
1596
- this._customFooterRowDefs.delete(footerRowDef);
1597
- this._footerRowDefChanged = true;
1598
- }
1599
- /** Sets a no data row definition that was not included as a part of the content children. */
1600
- setNoDataRow(noDataRow) {
1601
- this._customNoDataRow = noDataRow;
1602
- }
1603
- /**
1604
- * Updates the header sticky styles. First resets all applied styles with respect to the cells
1605
- * sticking to the top. Then, evaluating which cells need to be stuck to the top. This is
1606
- * automatically called when the header row changes its displayed set of columns, or if its
1607
- * sticky input changes. May be called manually for cases where the cell content changes outside
1608
- * of these events.
1609
- */
1610
- updateStickyHeaderRowStyles() {
1611
- const headerRows = this._getRenderedRows(this._headerRowOutlet);
1612
- // Hide the thead element if there are no header rows. This is necessary to satisfy
1613
- // overzealous a11y checkers that fail because the `rowgroup` element does not contain
1614
- // required child `row`.
1615
- if (this._isNativeHtmlTable) {
1616
- const thead = closestTableSection(this._headerRowOutlet, 'thead');
1617
- if (thead) {
1618
- thead.style.display = headerRows.length ? '' : 'none';
1619
- }
1620
- }
1621
- const stickyStates = this._headerRowDefs.map(def => def.sticky);
1622
- this._stickyStyler.clearStickyPositioning(headerRows, ['top']);
1623
- this._stickyStyler.stickRows(headerRows, stickyStates, 'top');
1624
- // Reset the dirty state of the sticky input change since it has been used.
1625
- this._headerRowDefs.forEach(def => def.resetStickyChanged());
1626
- }
1627
- /**
1628
- * Updates the footer sticky styles. First resets all applied styles with respect to the cells
1629
- * sticking to the bottom. Then, evaluating which cells need to be stuck to the bottom. This is
1630
- * automatically called when the footer row changes its displayed set of columns, or if its
1631
- * sticky input changes. May be called manually for cases where the cell content changes outside
1632
- * of these events.
1633
- */
1634
- updateStickyFooterRowStyles() {
1635
- const footerRows = this._getRenderedRows(this._footerRowOutlet);
1636
- // Hide the tfoot element if there are no footer rows. This is necessary to satisfy
1637
- // overzealous a11y checkers that fail because the `rowgroup` element does not contain
1638
- // required child `row`.
1639
- if (this._isNativeHtmlTable) {
1640
- const tfoot = closestTableSection(this._footerRowOutlet, 'tfoot');
1641
- if (tfoot) {
1642
- tfoot.style.display = footerRows.length ? '' : 'none';
1643
- }
1644
- }
1645
- const stickyStates = this._footerRowDefs.map(def => def.sticky);
1646
- this._stickyStyler.clearStickyPositioning(footerRows, ['bottom']);
1647
- this._stickyStyler.stickRows(footerRows, stickyStates, 'bottom');
1648
- this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement, stickyStates);
1649
- // Reset the dirty state of the sticky input change since it has been used.
1650
- this._footerRowDefs.forEach(def => def.resetStickyChanged());
1651
- }
1652
- /**
1653
- * Updates the column sticky styles. First resets all applied styles with respect to the cells
1654
- * sticking to the left and right. Then sticky styles are added for the left and right according
1655
- * to the column definitions for each cell in each row. This is automatically called when
1656
- * the data source provides a new set of data or when a column definition changes its sticky
1657
- * input. May be called manually for cases where the cell content changes outside of these events.
1658
- */
1659
- updateStickyColumnStyles() {
1660
- const headerRows = this._getRenderedRows(this._headerRowOutlet);
1661
- const dataRows = this._getRenderedRows(this._rowOutlet);
1662
- const footerRows = this._getRenderedRows(this._footerRowOutlet);
1663
- // For tables not using a fixed layout, the column widths may change when new rows are rendered.
1664
- // In a table using a fixed layout, row content won't affect column width, so sticky styles
1665
- // don't need to be cleared unless either the sticky column config changes or one of the row
1666
- // defs change.
1667
- if ((this._isNativeHtmlTable && !this._fixedLayout) || this._stickyColumnStylesNeedReset) {
1668
- // Clear the left and right positioning from all columns in the table across all rows since
1669
- // sticky columns span across all table sections (header, data, footer)
1670
- this._stickyStyler.clearStickyPositioning([...headerRows, ...dataRows, ...footerRows], ['left', 'right']);
1671
- this._stickyColumnStylesNeedReset = false;
1672
- }
1673
- // Update the sticky styles for each header row depending on the def's sticky state
1674
- headerRows.forEach((headerRow, i) => {
1675
- this._addStickyColumnStyles([headerRow], this._headerRowDefs[i]);
1676
- });
1677
- // Update the sticky styles for each data row depending on its def's sticky state
1678
- this._rowDefs.forEach(rowDef => {
1679
- // Collect all the rows rendered with this row definition.
1680
- const rows = [];
1681
- for (let i = 0; i < dataRows.length; i++) {
1682
- if (this._renderRows[i].rowDef === rowDef) {
1683
- rows.push(dataRows[i]);
1684
- }
1685
- }
1686
- this._addStickyColumnStyles(rows, rowDef);
1687
- });
1688
- // Update the sticky styles for each footer row depending on the def's sticky state
1689
- footerRows.forEach((footerRow, i) => {
1690
- this._addStickyColumnStyles([footerRow], this._footerRowDefs[i]);
1691
- });
1692
- // Reset the dirty state of the sticky input change since it has been used.
1693
- Array.from(this._columnDefsByName.values()).forEach(def => def.resetStickyChanged());
1694
- }
1695
- /** Invoked whenever an outlet is created and has been assigned to the table. */
1696
- _outletAssigned() {
1697
- // Trigger the first render once all outlets have been assigned. We do it this way, as
1698
- // opposed to waiting for the next `ngAfterContentChecked`, because we don't know when
1699
- // the next change detection will happen.
1700
- // Also we can't use queries to resolve the outlets, because they're wrapped in a
1701
- // conditional, so we have to rely on them being assigned via DI.
1702
- if (!this._hasAllOutlets &&
1703
- this._rowOutlet &&
1704
- this._headerRowOutlet &&
1705
- this._footerRowOutlet &&
1706
- this._noDataRowOutlet) {
1707
- this._hasAllOutlets = true;
1708
- // In some setups this may fire before `ngAfterContentInit`
1709
- // so we need a check here. See #28538.
1710
- if (this._canRender()) {
1711
- this._render();
1712
- }
1713
- }
1714
- }
1715
- /** Whether the table has all the information to start rendering. */
1716
- _canRender() {
1717
- return this._hasAllOutlets && this._hasInitialized;
1718
- }
1719
- /** Renders the table if its state has changed. */
1720
- _render() {
1721
- // Cache the row and column definitions gathered by ContentChildren and programmatic injection.
1722
- this._cacheRowDefs();
1723
- this._cacheColumnDefs();
1724
- // Make sure that the user has at least added header, footer, or data row def.
1725
- if (!this._headerRowDefs.length &&
1726
- !this._footerRowDefs.length &&
1727
- !this._rowDefs.length &&
1728
- (typeof ngDevMode === 'undefined' || ngDevMode)) {
1729
- throw getTableMissingRowDefsError();
1730
- }
1731
- // Render updates if the list of columns have been changed for the header, row, or footer defs.
1732
- const columnsChanged = this._renderUpdatedColumns();
1733
- const rowDefsChanged = columnsChanged || this._headerRowDefChanged || this._footerRowDefChanged;
1734
- // Ensure sticky column styles are reset if set to `true` elsewhere.
1735
- this._stickyColumnStylesNeedReset = this._stickyColumnStylesNeedReset || rowDefsChanged;
1736
- this._forceRecalculateCellWidths = rowDefsChanged;
1737
- // If the header row definition has been changed, trigger a render to the header row.
1738
- if (this._headerRowDefChanged) {
1739
- this._forceRenderHeaderRows();
1740
- this._headerRowDefChanged = false;
1741
- }
1742
- // If the footer row definition has been changed, trigger a render to the footer row.
1743
- if (this._footerRowDefChanged) {
1744
- this._forceRenderFooterRows();
1745
- this._footerRowDefChanged = false;
1746
- }
1747
- // If there is a data source and row definitions, connect to the data source unless a
1748
- // connection has already been made.
1749
- if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) {
1750
- this._observeRenderChanges();
1751
- }
1752
- else if (this._stickyColumnStylesNeedReset) {
1753
- // In the above case, _observeRenderChanges will result in updateStickyColumnStyles being
1754
- // called when it row data arrives. Otherwise, we need to call it proactively.
1755
- this.updateStickyColumnStyles();
1756
- }
1757
- this._checkStickyStates();
1758
- }
1759
- /**
1760
- * Get the list of RenderRow objects to render according to the current list of data and defined
1761
- * row definitions. If the previous list already contained a particular pair, it should be reused
1762
- * so that the differ equates their references.
1763
- */
1764
- _getAllRenderRows() {
1765
- const renderRows = [];
1766
- // Store the cache and create a new one. Any re-used RenderRow objects will be moved into the
1767
- // new cache while unused ones can be picked up by garbage collection.
1768
- const prevCachedRenderRows = this._cachedRenderRowsMap;
1769
- this._cachedRenderRowsMap = new Map();
1770
- if (!this._data) {
1771
- return renderRows;
1772
- }
1773
- // For each data object, get the list of rows that should be rendered, represented by the
1774
- // respective `RenderRow` object which is the pair of `data` and `CdkRowDef`.
1775
- for (let i = 0; i < this._data.length; i++) {
1776
- let data = this._data[i];
1777
- const renderRowsForData = this._getRenderRowsForData(data, i, prevCachedRenderRows.get(data));
1778
- if (!this._cachedRenderRowsMap.has(data)) {
1779
- this._cachedRenderRowsMap.set(data, new WeakMap());
1780
- }
1781
- for (let j = 0; j < renderRowsForData.length; j++) {
1782
- let renderRow = renderRowsForData[j];
1783
- const cache = this._cachedRenderRowsMap.get(renderRow.data);
1784
- if (cache.has(renderRow.rowDef)) {
1785
- cache.get(renderRow.rowDef).push(renderRow);
1786
- }
1787
- else {
1788
- cache.set(renderRow.rowDef, [renderRow]);
1789
- }
1790
- renderRows.push(renderRow);
1791
- }
1792
- }
1793
- return renderRows;
1794
- }
1795
- /**
1796
- * Gets a list of `RenderRow<T>` for the provided data object and any `CdkRowDef` objects that
1797
- * should be rendered for this data. Reuses the cached RenderRow objects if they match the same
1798
- * `(T, CdkRowDef)` pair.
1799
- */
1800
- _getRenderRowsForData(data, dataIndex, cache) {
1801
- const rowDefs = this._getRowDefs(data, dataIndex);
1802
- return rowDefs.map(rowDef => {
1803
- const cachedRenderRows = cache && cache.has(rowDef) ? cache.get(rowDef) : [];
1804
- if (cachedRenderRows.length) {
1805
- const dataRow = cachedRenderRows.shift();
1806
- dataRow.dataIndex = dataIndex;
1807
- return dataRow;
1808
- }
1809
- else {
1810
- return { data, rowDef, dataIndex };
1811
- }
1812
- });
1813
- }
1814
- /** Update the map containing the content's column definitions. */
1815
- _cacheColumnDefs() {
1816
- this._columnDefsByName.clear();
1817
- const columnDefs = mergeArrayAndSet(this._getOwnDefs(this._contentColumnDefs), this._customColumnDefs);
1818
- columnDefs.forEach(columnDef => {
1819
- if (this._columnDefsByName.has(columnDef.name) &&
1820
- (typeof ngDevMode === 'undefined' || ngDevMode)) {
1821
- throw getTableDuplicateColumnNameError(columnDef.name);
1822
- }
1823
- this._columnDefsByName.set(columnDef.name, columnDef);
1824
- });
1825
- }
1826
- /** Update the list of all available row definitions that can be used. */
1827
- _cacheRowDefs() {
1828
- this._headerRowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentHeaderRowDefs), this._customHeaderRowDefs);
1829
- this._footerRowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentFooterRowDefs), this._customFooterRowDefs);
1830
- this._rowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentRowDefs), this._customRowDefs);
1831
- // After all row definitions are determined, find the row definition to be considered default.
1832
- const defaultRowDefs = this._rowDefs.filter(def => !def.when);
1833
- if (!this.multiTemplateDataRows &&
1834
- defaultRowDefs.length > 1 &&
1835
- (typeof ngDevMode === 'undefined' || ngDevMode)) {
1836
- throw getTableMultipleDefaultRowDefsError();
1837
- }
1838
- this._defaultRowDef = defaultRowDefs[0];
1839
- }
1840
- /**
1841
- * Check if the header, data, or footer rows have changed what columns they want to display or
1842
- * whether the sticky states have changed for the header or footer. If there is a diff, then
1843
- * re-render that section.
1844
- */
1845
- _renderUpdatedColumns() {
1846
- const columnsDiffReducer = (acc, def) => {
1847
- // The differ should be run for every column, even if `acc` is already
1848
- // true (see #29922)
1849
- const diff = !!def.getColumnsDiff();
1850
- return acc || diff;
1851
- };
1852
- // Force re-render data rows if the list of column definitions have changed.
1853
- const dataColumnsChanged = this._rowDefs.reduce(columnsDiffReducer, false);
1854
- if (dataColumnsChanged) {
1855
- this._forceRenderDataRows();
1856
- }
1857
- // Force re-render header/footer rows if the list of column definitions have changed.
1858
- const headerColumnsChanged = this._headerRowDefs.reduce(columnsDiffReducer, false);
1859
- if (headerColumnsChanged) {
1860
- this._forceRenderHeaderRows();
1861
- }
1862
- const footerColumnsChanged = this._footerRowDefs.reduce(columnsDiffReducer, false);
1863
- if (footerColumnsChanged) {
1864
- this._forceRenderFooterRows();
1865
- }
1866
- return dataColumnsChanged || headerColumnsChanged || footerColumnsChanged;
1867
- }
1868
- /**
1869
- * Switch to the provided data source by resetting the data and unsubscribing from the current
1870
- * render change subscription if one exists. If the data source is null, interpret this by
1871
- * clearing the row outlet. Otherwise start listening for new data.
1872
- */
1873
- _switchDataSource(dataSource) {
1874
- this._data = [];
1875
- if (isDataSource(this.dataSource)) {
1876
- this.dataSource.disconnect(this);
1877
- }
1878
- // Stop listening for data from the previous data source.
1879
- if (this._renderChangeSubscription) {
1880
- this._renderChangeSubscription.unsubscribe();
1881
- this._renderChangeSubscription = null;
1882
- }
1883
- if (!dataSource) {
1884
- if (this._dataDiffer) {
1885
- this._dataDiffer.diff([]);
1886
- }
1887
- if (this._rowOutlet) {
1888
- this._rowOutlet.viewContainer.clear();
1889
- }
1890
- }
1891
- this._dataSource = dataSource;
1892
- }
1893
- /** Set up a subscription for the data provided by the data source. */
1894
- _observeRenderChanges() {
1895
- // If no data source has been set, there is nothing to observe for changes.
1896
- if (!this.dataSource) {
1897
- return;
1898
- }
1899
- let dataStream;
1900
- if (isDataSource(this.dataSource)) {
1901
- dataStream = this.dataSource.connect(this);
1902
- }
1903
- else if (isObservable(this.dataSource)) {
1904
- dataStream = this.dataSource;
1905
- }
1906
- else if (Array.isArray(this.dataSource)) {
1907
- dataStream = of(this.dataSource);
1908
- }
1909
- if (dataStream === undefined && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1910
- throw getTableUnknownDataSourceError();
1911
- }
1912
- this._renderChangeSubscription = dataStream
1913
- .pipe(takeUntil(this._onDestroy))
1914
- .subscribe(data => {
1915
- this._data = data || [];
1916
- this.renderRows();
1917
- });
1918
- }
1919
- /**
1920
- * Clears any existing content in the header row outlet and creates a new embedded view
1921
- * in the outlet using the header row definition.
1922
- */
1923
- _forceRenderHeaderRows() {
1924
- // Clear the header row outlet if any content exists.
1925
- if (this._headerRowOutlet.viewContainer.length > 0) {
1926
- this._headerRowOutlet.viewContainer.clear();
1927
- }
1928
- this._headerRowDefs.forEach((def, i) => this._renderRow(this._headerRowOutlet, def, i));
1929
- this.updateStickyHeaderRowStyles();
1930
- }
1931
- /**
1932
- * Clears any existing content in the footer row outlet and creates a new embedded view
1933
- * in the outlet using the footer row definition.
1934
- */
1935
- _forceRenderFooterRows() {
1936
- // Clear the footer row outlet if any content exists.
1937
- if (this._footerRowOutlet.viewContainer.length > 0) {
1938
- this._footerRowOutlet.viewContainer.clear();
1939
- }
1940
- this._footerRowDefs.forEach((def, i) => this._renderRow(this._footerRowOutlet, def, i));
1941
- this.updateStickyFooterRowStyles();
1942
- }
1943
- /** Adds the sticky column styles for the rows according to the columns' stick states. */
1944
- _addStickyColumnStyles(rows, rowDef) {
1945
- const columnDefs = Array.from(rowDef?.columns || []).map(columnName => {
1946
- const columnDef = this._columnDefsByName.get(columnName);
1947
- if (!columnDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1948
- throw getTableUnknownColumnError(columnName);
1949
- }
1950
- return columnDef;
1951
- });
1952
- const stickyStartStates = columnDefs.map(columnDef => columnDef.sticky);
1953
- const stickyEndStates = columnDefs.map(columnDef => columnDef.stickyEnd);
1954
- this._stickyStyler.updateStickyColumns(rows, stickyStartStates, stickyEndStates, !this._fixedLayout || this._forceRecalculateCellWidths);
1955
- }
1956
- /** Gets the list of rows that have been rendered in the row outlet. */
1957
- _getRenderedRows(rowOutlet) {
1958
- const renderedRows = [];
1959
- for (let i = 0; i < rowOutlet.viewContainer.length; i++) {
1960
- const viewRef = rowOutlet.viewContainer.get(i);
1961
- renderedRows.push(viewRef.rootNodes[0]);
1962
- }
1963
- return renderedRows;
1964
- }
1965
- /**
1966
- * Get the matching row definitions that should be used for this row data. If there is only
1967
- * one row definition, it is returned. Otherwise, find the row definitions that has a when
1968
- * predicate that returns true with the data. If none return true, return the default row
1969
- * definition.
1970
- */
1971
- _getRowDefs(data, dataIndex) {
1972
- if (this._rowDefs.length == 1) {
1973
- return [this._rowDefs[0]];
1974
- }
1975
- let rowDefs = [];
1976
- if (this.multiTemplateDataRows) {
1977
- rowDefs = this._rowDefs.filter(def => !def.when || def.when(dataIndex, data));
1978
- }
1979
- else {
1980
- let rowDef = this._rowDefs.find(def => def.when && def.when(dataIndex, data)) || this._defaultRowDef;
1981
- if (rowDef) {
1982
- rowDefs.push(rowDef);
1983
- }
1984
- }
1985
- if (!rowDefs.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1986
- throw getTableMissingMatchingRowDefError(data);
1987
- }
1988
- return rowDefs;
1989
- }
1990
- _getEmbeddedViewArgs(renderRow, index) {
1991
- const rowDef = renderRow.rowDef;
1992
- const context = { $implicit: renderRow.data };
1574
+ this._isServer = !this._platform.isBrowser;
1575
+ this._isNativeHtmlTable = this._elementRef.nativeElement.nodeName === 'TABLE';
1576
+ this._dataDiffer = this._differs.find([]).create((_i, dataRow) => {
1577
+ return this.trackBy ? this.trackBy(dataRow.dataIndex, dataRow.data) : dataRow;
1578
+ });
1579
+ }
1580
+ ngOnInit() {
1581
+ this._setupStickyStyler();
1582
+ this._viewportRuler.change().pipe(takeUntil(this._onDestroy)).subscribe(() => {
1583
+ this._forceRecalculateCellWidths = true;
1584
+ });
1585
+ }
1586
+ ngAfterContentInit() {
1587
+ this._hasInitialized = true;
1588
+ }
1589
+ ngAfterContentChecked() {
1590
+ if (this._canRender()) {
1591
+ this._render();
1592
+ }
1593
+ }
1594
+ ngOnDestroy() {
1595
+ this._stickyStyler?.destroy();
1596
+ [this._rowOutlet?.viewContainer, this._headerRowOutlet?.viewContainer, this._footerRowOutlet?.viewContainer, this._cachedRenderRowsMap, this._customColumnDefs, this._customRowDefs, this._customHeaderRowDefs, this._customFooterRowDefs, this._columnDefsByName].forEach(def => {
1597
+ def?.clear();
1598
+ });
1599
+ this._headerRowDefs = [];
1600
+ this._footerRowDefs = [];
1601
+ this._defaultRowDef = null;
1602
+ this._onDestroy.next();
1603
+ this._onDestroy.complete();
1604
+ if (isDataSource(this.dataSource)) {
1605
+ this.dataSource.disconnect(this);
1606
+ }
1607
+ }
1608
+ renderRows() {
1609
+ this._renderRows = this._getAllRenderRows();
1610
+ const changes = this._dataDiffer.diff(this._renderRows);
1611
+ if (!changes) {
1612
+ this._updateNoDataRow();
1613
+ this.contentChanged.next();
1614
+ return;
1615
+ }
1616
+ const viewContainer = this._rowOutlet.viewContainer;
1617
+ this._viewRepeater.applyChanges(changes, viewContainer, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record.item, currentIndex), record => record.item.data, change => {
1618
+ if (change.operation === _ViewRepeaterOperation.INSERTED && change.context) {
1619
+ this._renderCellTemplateForItem(change.record.item.rowDef, change.context);
1620
+ }
1621
+ });
1622
+ this._updateRowIndexContext();
1623
+ changes.forEachIdentityChange(record => {
1624
+ const rowView = viewContainer.get(record.currentIndex);
1625
+ rowView.context.$implicit = record.item.data;
1626
+ });
1627
+ this._updateNoDataRow();
1628
+ this.contentChanged.next();
1629
+ this.updateStickyColumnStyles();
1630
+ }
1631
+ addColumnDef(columnDef) {
1632
+ this._customColumnDefs.add(columnDef);
1633
+ }
1634
+ removeColumnDef(columnDef) {
1635
+ this._customColumnDefs.delete(columnDef);
1636
+ }
1637
+ addRowDef(rowDef) {
1638
+ this._customRowDefs.add(rowDef);
1639
+ }
1640
+ removeRowDef(rowDef) {
1641
+ this._customRowDefs.delete(rowDef);
1642
+ }
1643
+ addHeaderRowDef(headerRowDef) {
1644
+ this._customHeaderRowDefs.add(headerRowDef);
1645
+ this._headerRowDefChanged = true;
1646
+ }
1647
+ removeHeaderRowDef(headerRowDef) {
1648
+ this._customHeaderRowDefs.delete(headerRowDef);
1649
+ this._headerRowDefChanged = true;
1650
+ }
1651
+ addFooterRowDef(footerRowDef) {
1652
+ this._customFooterRowDefs.add(footerRowDef);
1653
+ this._footerRowDefChanged = true;
1654
+ }
1655
+ removeFooterRowDef(footerRowDef) {
1656
+ this._customFooterRowDefs.delete(footerRowDef);
1657
+ this._footerRowDefChanged = true;
1658
+ }
1659
+ setNoDataRow(noDataRow) {
1660
+ this._customNoDataRow = noDataRow;
1661
+ }
1662
+ updateStickyHeaderRowStyles() {
1663
+ const headerRows = this._getRenderedRows(this._headerRowOutlet);
1664
+ if (this._isNativeHtmlTable) {
1665
+ const thead = closestTableSection(this._headerRowOutlet, 'thead');
1666
+ if (thead) {
1667
+ thead.style.display = headerRows.length ? '' : 'none';
1668
+ }
1669
+ }
1670
+ const stickyStates = this._headerRowDefs.map(def => def.sticky);
1671
+ this._stickyStyler.clearStickyPositioning(headerRows, ['top']);
1672
+ this._stickyStyler.stickRows(headerRows, stickyStates, 'top');
1673
+ this._headerRowDefs.forEach(def => def.resetStickyChanged());
1674
+ }
1675
+ updateStickyFooterRowStyles() {
1676
+ const footerRows = this._getRenderedRows(this._footerRowOutlet);
1677
+ if (this._isNativeHtmlTable) {
1678
+ const tfoot = closestTableSection(this._footerRowOutlet, 'tfoot');
1679
+ if (tfoot) {
1680
+ tfoot.style.display = footerRows.length ? '' : 'none';
1681
+ }
1682
+ }
1683
+ const stickyStates = this._footerRowDefs.map(def => def.sticky);
1684
+ this._stickyStyler.clearStickyPositioning(footerRows, ['bottom']);
1685
+ this._stickyStyler.stickRows(footerRows, stickyStates, 'bottom');
1686
+ this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement, stickyStates);
1687
+ this._footerRowDefs.forEach(def => def.resetStickyChanged());
1688
+ }
1689
+ updateStickyColumnStyles() {
1690
+ const headerRows = this._getRenderedRows(this._headerRowOutlet);
1691
+ const dataRows = this._getRenderedRows(this._rowOutlet);
1692
+ const footerRows = this._getRenderedRows(this._footerRowOutlet);
1693
+ if (this._isNativeHtmlTable && !this._fixedLayout || this._stickyColumnStylesNeedReset) {
1694
+ this._stickyStyler.clearStickyPositioning([...headerRows, ...dataRows, ...footerRows], ['left', 'right']);
1695
+ this._stickyColumnStylesNeedReset = false;
1696
+ }
1697
+ headerRows.forEach((headerRow, i) => {
1698
+ this._addStickyColumnStyles([headerRow], this._headerRowDefs[i]);
1699
+ });
1700
+ this._rowDefs.forEach(rowDef => {
1701
+ const rows = [];
1702
+ for (let i = 0; i < dataRows.length; i++) {
1703
+ if (this._renderRows[i].rowDef === rowDef) {
1704
+ rows.push(dataRows[i]);
1705
+ }
1706
+ }
1707
+ this._addStickyColumnStyles(rows, rowDef);
1708
+ });
1709
+ footerRows.forEach((footerRow, i) => {
1710
+ this._addStickyColumnStyles([footerRow], this._footerRowDefs[i]);
1711
+ });
1712
+ Array.from(this._columnDefsByName.values()).forEach(def => def.resetStickyChanged());
1713
+ }
1714
+ _outletAssigned() {
1715
+ if (!this._hasAllOutlets && this._rowOutlet && this._headerRowOutlet && this._footerRowOutlet && this._noDataRowOutlet) {
1716
+ this._hasAllOutlets = true;
1717
+ if (this._canRender()) {
1718
+ this._render();
1719
+ }
1720
+ }
1721
+ }
1722
+ _canRender() {
1723
+ return this._hasAllOutlets && this._hasInitialized;
1724
+ }
1725
+ _render() {
1726
+ this._cacheRowDefs();
1727
+ this._cacheColumnDefs();
1728
+ if (!this._headerRowDefs.length && !this._footerRowDefs.length && !this._rowDefs.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1729
+ throw getTableMissingRowDefsError();
1730
+ }
1731
+ const columnsChanged = this._renderUpdatedColumns();
1732
+ const rowDefsChanged = columnsChanged || this._headerRowDefChanged || this._footerRowDefChanged;
1733
+ this._stickyColumnStylesNeedReset = this._stickyColumnStylesNeedReset || rowDefsChanged;
1734
+ this._forceRecalculateCellWidths = rowDefsChanged;
1735
+ if (this._headerRowDefChanged) {
1736
+ this._forceRenderHeaderRows();
1737
+ this._headerRowDefChanged = false;
1738
+ }
1739
+ if (this._footerRowDefChanged) {
1740
+ this._forceRenderFooterRows();
1741
+ this._footerRowDefChanged = false;
1742
+ }
1743
+ if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) {
1744
+ this._observeRenderChanges();
1745
+ } else if (this._stickyColumnStylesNeedReset) {
1746
+ this.updateStickyColumnStyles();
1747
+ }
1748
+ this._checkStickyStates();
1749
+ }
1750
+ _getAllRenderRows() {
1751
+ const renderRows = [];
1752
+ const prevCachedRenderRows = this._cachedRenderRowsMap;
1753
+ this._cachedRenderRowsMap = new Map();
1754
+ if (!this._data) {
1755
+ return renderRows;
1756
+ }
1757
+ for (let i = 0; i < this._data.length; i++) {
1758
+ let data = this._data[i];
1759
+ const renderRowsForData = this._getRenderRowsForData(data, i, prevCachedRenderRows.get(data));
1760
+ if (!this._cachedRenderRowsMap.has(data)) {
1761
+ this._cachedRenderRowsMap.set(data, new WeakMap());
1762
+ }
1763
+ for (let j = 0; j < renderRowsForData.length; j++) {
1764
+ let renderRow = renderRowsForData[j];
1765
+ const cache = this._cachedRenderRowsMap.get(renderRow.data);
1766
+ if (cache.has(renderRow.rowDef)) {
1767
+ cache.get(renderRow.rowDef).push(renderRow);
1768
+ } else {
1769
+ cache.set(renderRow.rowDef, [renderRow]);
1770
+ }
1771
+ renderRows.push(renderRow);
1772
+ }
1773
+ }
1774
+ return renderRows;
1775
+ }
1776
+ _getRenderRowsForData(data, dataIndex, cache) {
1777
+ const rowDefs = this._getRowDefs(data, dataIndex);
1778
+ return rowDefs.map(rowDef => {
1779
+ const cachedRenderRows = cache && cache.has(rowDef) ? cache.get(rowDef) : [];
1780
+ if (cachedRenderRows.length) {
1781
+ const dataRow = cachedRenderRows.shift();
1782
+ dataRow.dataIndex = dataIndex;
1783
+ return dataRow;
1784
+ } else {
1993
1785
  return {
1994
- templateRef: rowDef.template,
1995
- context,
1996
- index,
1786
+ data,
1787
+ rowDef,
1788
+ dataIndex
1997
1789
  };
1998
- }
1999
- /**
2000
- * Creates a new row template in the outlet and fills it with the set of cell templates.
2001
- * Optionally takes a context to provide to the row and cells, as well as an optional index
2002
- * of where to place the new row template in the outlet.
2003
- */
2004
- _renderRow(outlet, rowDef, index, context = {}) {
2005
- // TODO(andrewseguin): enforce that one outlet was instantiated from createEmbeddedView
2006
- const view = outlet.viewContainer.createEmbeddedView(rowDef.template, context, index);
2007
- this._renderCellTemplateForItem(rowDef, context);
2008
- return view;
2009
- }
2010
- _renderCellTemplateForItem(rowDef, context) {
2011
- for (let cellTemplate of this._getCellTemplates(rowDef)) {
2012
- if (CdkCellOutlet.mostRecentCellOutlet) {
2013
- CdkCellOutlet.mostRecentCellOutlet._viewContainer.createEmbeddedView(cellTemplate, context);
2014
- }
2015
- }
2016
- this._changeDetectorRef.markForCheck();
2017
- }
2018
- /**
2019
- * Updates the index-related context for each row to reflect any changes in the index of the rows,
2020
- * e.g. first/last/even/odd.
2021
- */
2022
- _updateRowIndexContext() {
2023
- const viewContainer = this._rowOutlet.viewContainer;
2024
- for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) {
2025
- const viewRef = viewContainer.get(renderIndex);
2026
- const context = viewRef.context;
2027
- context.count = count;
2028
- context.first = renderIndex === 0;
2029
- context.last = renderIndex === count - 1;
2030
- context.even = renderIndex % 2 === 0;
2031
- context.odd = !context.even;
2032
- if (this.multiTemplateDataRows) {
2033
- context.dataIndex = this._renderRows[renderIndex].dataIndex;
2034
- context.renderIndex = renderIndex;
2035
- }
2036
- else {
2037
- context.index = this._renderRows[renderIndex].dataIndex;
2038
- }
2039
- }
2040
- }
2041
- /** Gets the column definitions for the provided row def. */
2042
- _getCellTemplates(rowDef) {
2043
- if (!rowDef || !rowDef.columns) {
2044
- return [];
2045
- }
2046
- return Array.from(rowDef.columns, columnId => {
2047
- const column = this._columnDefsByName.get(columnId);
2048
- if (!column && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2049
- throw getTableUnknownColumnError(columnId);
2050
- }
2051
- return rowDef.extractCellTemplate(column);
2052
- });
2053
- }
2054
- /**
2055
- * Forces a re-render of the data rows. Should be called in cases where there has been an input
2056
- * change that affects the evaluation of which rows should be rendered, e.g. toggling
2057
- * `multiTemplateDataRows` or adding/removing row definitions.
2058
- */
2059
- _forceRenderDataRows() {
1790
+ }
1791
+ });
1792
+ }
1793
+ _cacheColumnDefs() {
1794
+ this._columnDefsByName.clear();
1795
+ const columnDefs = mergeArrayAndSet(this._getOwnDefs(this._contentColumnDefs), this._customColumnDefs);
1796
+ columnDefs.forEach(columnDef => {
1797
+ if (this._columnDefsByName.has(columnDef.name) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1798
+ throw getTableDuplicateColumnNameError(columnDef.name);
1799
+ }
1800
+ this._columnDefsByName.set(columnDef.name, columnDef);
1801
+ });
1802
+ }
1803
+ _cacheRowDefs() {
1804
+ this._headerRowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentHeaderRowDefs), this._customHeaderRowDefs);
1805
+ this._footerRowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentFooterRowDefs), this._customFooterRowDefs);
1806
+ this._rowDefs = mergeArrayAndSet(this._getOwnDefs(this._contentRowDefs), this._customRowDefs);
1807
+ const defaultRowDefs = this._rowDefs.filter(def => !def.when);
1808
+ if (!this.multiTemplateDataRows && defaultRowDefs.length > 1 && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1809
+ throw getTableMultipleDefaultRowDefsError();
1810
+ }
1811
+ this._defaultRowDef = defaultRowDefs[0];
1812
+ }
1813
+ _renderUpdatedColumns() {
1814
+ const columnsDiffReducer = (acc, def) => {
1815
+ const diff = !!def.getColumnsDiff();
1816
+ return acc || diff;
1817
+ };
1818
+ const dataColumnsChanged = this._rowDefs.reduce(columnsDiffReducer, false);
1819
+ if (dataColumnsChanged) {
1820
+ this._forceRenderDataRows();
1821
+ }
1822
+ const headerColumnsChanged = this._headerRowDefs.reduce(columnsDiffReducer, false);
1823
+ if (headerColumnsChanged) {
1824
+ this._forceRenderHeaderRows();
1825
+ }
1826
+ const footerColumnsChanged = this._footerRowDefs.reduce(columnsDiffReducer, false);
1827
+ if (footerColumnsChanged) {
1828
+ this._forceRenderFooterRows();
1829
+ }
1830
+ return dataColumnsChanged || headerColumnsChanged || footerColumnsChanged;
1831
+ }
1832
+ _switchDataSource(dataSource) {
1833
+ this._data = [];
1834
+ if (isDataSource(this.dataSource)) {
1835
+ this.dataSource.disconnect(this);
1836
+ }
1837
+ if (this._renderChangeSubscription) {
1838
+ this._renderChangeSubscription.unsubscribe();
1839
+ this._renderChangeSubscription = null;
1840
+ }
1841
+ if (!dataSource) {
1842
+ if (this._dataDiffer) {
2060
1843
  this._dataDiffer.diff([]);
1844
+ }
1845
+ if (this._rowOutlet) {
2061
1846
  this._rowOutlet.viewContainer.clear();
2062
- this.renderRows();
2063
- }
2064
- /**
2065
- * Checks if there has been a change in sticky states since last check and applies the correct
2066
- * sticky styles. Since checking resets the "dirty" state, this should only be performed once
2067
- * during a change detection and after the inputs are settled (after content check).
2068
- */
2069
- _checkStickyStates() {
2070
- const stickyCheckReducer = (acc, d) => {
2071
- return acc || d.hasStickyChanged();
2072
- };
2073
- // Note that the check needs to occur for every definition since it notifies the definition
2074
- // that it can reset its dirty state. Using another operator like `some` may short-circuit
2075
- // remaining definitions and leave them in an unchecked state.
2076
- if (this._headerRowDefs.reduce(stickyCheckReducer, false)) {
2077
- this.updateStickyHeaderRowStyles();
2078
- }
2079
- if (this._footerRowDefs.reduce(stickyCheckReducer, false)) {
2080
- this.updateStickyFooterRowStyles();
2081
- }
2082
- if (Array.from(this._columnDefsByName.values()).reduce(stickyCheckReducer, false)) {
2083
- this._stickyColumnStylesNeedReset = true;
2084
- this.updateStickyColumnStyles();
2085
- }
2086
- }
2087
- /**
2088
- * Creates the sticky styler that will be used for sticky rows and columns. Listens
2089
- * for directionality changes and provides the latest direction to the styler. Re-applies column
2090
- * stickiness when directionality changes.
2091
- */
2092
- _setupStickyStyler() {
2093
- const direction = this._dir ? this._dir.value : 'ltr';
2094
- this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, this.stickyCssClass, this._platform.isBrowser, this.needsPositionStickyOnElement, direction, this._stickyPositioningListener, this._injector);
2095
- (this._dir ? this._dir.change : of())
2096
- .pipe(takeUntil(this._onDestroy))
2097
- .subscribe(value => {
2098
- this._stickyStyler.direction = value;
2099
- this.updateStickyColumnStyles();
2100
- });
2101
- }
2102
- /** Filters definitions that belong to this table from a QueryList. */
2103
- _getOwnDefs(items) {
2104
- return items.filter(item => !item._table || item._table === this);
2105
- }
2106
- /** Creates or removes the no data row, depending on whether any data is being shown. */
2107
- _updateNoDataRow() {
2108
- const noDataRow = this._customNoDataRow || this._noDataRow;
2109
- if (!noDataRow) {
2110
- return;
2111
- }
2112
- const shouldShow = this._rowOutlet.viewContainer.length === 0;
2113
- if (shouldShow === this._isShowingNoDataRow) {
2114
- return;
2115
- }
2116
- const container = this._noDataRowOutlet.viewContainer;
2117
- if (shouldShow) {
2118
- const view = container.createEmbeddedView(noDataRow.templateRef);
2119
- const rootNode = view.rootNodes[0];
2120
- // Only add the attributes if we have a single root node since it's hard
2121
- // to figure out which one to add it to when there are multiple.
2122
- if (view.rootNodes.length === 1 && rootNode?.nodeType === this._document.ELEMENT_NODE) {
2123
- rootNode.setAttribute('role', 'row');
2124
- rootNode.classList.add(...noDataRow._contentClassNames);
2125
- const cells = rootNode.querySelectorAll(noDataRow._cellSelector);
2126
- for (let i = 0; i < cells.length; i++) {
2127
- cells[i].classList.add(...noDataRow._cellClassNames);
2128
- }
2129
- }
2130
- }
2131
- else {
2132
- container.clear();
2133
- }
2134
- this._isShowingNoDataRow = shouldShow;
2135
- this._changeDetectorRef.markForCheck();
2136
- }
2137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
2138
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.0-next.2", type: CdkTable, isStandalone: true, selector: "cdk-table, table[cdk-table]", inputs: { trackBy: "trackBy", dataSource: "dataSource", multiTemplateDataRows: ["multiTemplateDataRows", "multiTemplateDataRows", booleanAttribute], fixedLayout: ["fixedLayout", "fixedLayout", booleanAttribute] }, outputs: { contentChanged: "contentChanged" }, host: { properties: { "class.cdk-table-fixed-layout": "fixedLayout" }, classAttribute: "cdk-table" }, providers: [
2139
- { provide: CDK_TABLE, useExisting: CdkTable },
2140
- { provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
2141
- // Prevent nested tables from seeing this table's StickyPositioningListener.
2142
- { provide: STICKY_POSITIONING_LISTENER, useValue: null },
2143
- ], queries: [{ propertyName: "_noDataRow", first: true, predicate: CdkNoDataRow, descendants: true }, { propertyName: "_contentColumnDefs", predicate: CdkColumnDef, descendants: true }, { propertyName: "_contentRowDefs", predicate: CdkRowDef, descendants: true }, { propertyName: "_contentHeaderRowDefs", predicate: CdkHeaderRowDef, descendants: true }, { propertyName: "_contentFooterRowDefs", predicate: CdkFooterRowDef, descendants: true }], exportAs: ["cdkTable"], ngImport: i0, template: `
1847
+ }
1848
+ }
1849
+ this._dataSource = dataSource;
1850
+ }
1851
+ _observeRenderChanges() {
1852
+ if (!this.dataSource) {
1853
+ return;
1854
+ }
1855
+ let dataStream;
1856
+ if (isDataSource(this.dataSource)) {
1857
+ dataStream = this.dataSource.connect(this);
1858
+ } else if (isObservable(this.dataSource)) {
1859
+ dataStream = this.dataSource;
1860
+ } else if (Array.isArray(this.dataSource)) {
1861
+ dataStream = of(this.dataSource);
1862
+ }
1863
+ if (dataStream === undefined && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1864
+ throw getTableUnknownDataSourceError();
1865
+ }
1866
+ this._renderChangeSubscription = dataStream.pipe(takeUntil(this._onDestroy)).subscribe(data => {
1867
+ this._data = data || [];
1868
+ this.renderRows();
1869
+ });
1870
+ }
1871
+ _forceRenderHeaderRows() {
1872
+ if (this._headerRowOutlet.viewContainer.length > 0) {
1873
+ this._headerRowOutlet.viewContainer.clear();
1874
+ }
1875
+ this._headerRowDefs.forEach((def, i) => this._renderRow(this._headerRowOutlet, def, i));
1876
+ this.updateStickyHeaderRowStyles();
1877
+ }
1878
+ _forceRenderFooterRows() {
1879
+ if (this._footerRowOutlet.viewContainer.length > 0) {
1880
+ this._footerRowOutlet.viewContainer.clear();
1881
+ }
1882
+ this._footerRowDefs.forEach((def, i) => this._renderRow(this._footerRowOutlet, def, i));
1883
+ this.updateStickyFooterRowStyles();
1884
+ }
1885
+ _addStickyColumnStyles(rows, rowDef) {
1886
+ const columnDefs = Array.from(rowDef?.columns || []).map(columnName => {
1887
+ const columnDef = this._columnDefsByName.get(columnName);
1888
+ if (!columnDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1889
+ throw getTableUnknownColumnError(columnName);
1890
+ }
1891
+ return columnDef;
1892
+ });
1893
+ const stickyStartStates = columnDefs.map(columnDef => columnDef.sticky);
1894
+ const stickyEndStates = columnDefs.map(columnDef => columnDef.stickyEnd);
1895
+ this._stickyStyler.updateStickyColumns(rows, stickyStartStates, stickyEndStates, !this._fixedLayout || this._forceRecalculateCellWidths);
1896
+ }
1897
+ _getRenderedRows(rowOutlet) {
1898
+ const renderedRows = [];
1899
+ for (let i = 0; i < rowOutlet.viewContainer.length; i++) {
1900
+ const viewRef = rowOutlet.viewContainer.get(i);
1901
+ renderedRows.push(viewRef.rootNodes[0]);
1902
+ }
1903
+ return renderedRows;
1904
+ }
1905
+ _getRowDefs(data, dataIndex) {
1906
+ if (this._rowDefs.length == 1) {
1907
+ return [this._rowDefs[0]];
1908
+ }
1909
+ let rowDefs = [];
1910
+ if (this.multiTemplateDataRows) {
1911
+ rowDefs = this._rowDefs.filter(def => !def.when || def.when(dataIndex, data));
1912
+ } else {
1913
+ let rowDef = this._rowDefs.find(def => def.when && def.when(dataIndex, data)) || this._defaultRowDef;
1914
+ if (rowDef) {
1915
+ rowDefs.push(rowDef);
1916
+ }
1917
+ }
1918
+ if (!rowDefs.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1919
+ throw getTableMissingMatchingRowDefError(data);
1920
+ }
1921
+ return rowDefs;
1922
+ }
1923
+ _getEmbeddedViewArgs(renderRow, index) {
1924
+ const rowDef = renderRow.rowDef;
1925
+ const context = {
1926
+ $implicit: renderRow.data
1927
+ };
1928
+ return {
1929
+ templateRef: rowDef.template,
1930
+ context,
1931
+ index
1932
+ };
1933
+ }
1934
+ _renderRow(outlet, rowDef, index, context = {}) {
1935
+ const view = outlet.viewContainer.createEmbeddedView(rowDef.template, context, index);
1936
+ this._renderCellTemplateForItem(rowDef, context);
1937
+ return view;
1938
+ }
1939
+ _renderCellTemplateForItem(rowDef, context) {
1940
+ for (let cellTemplate of this._getCellTemplates(rowDef)) {
1941
+ if (CdkCellOutlet.mostRecentCellOutlet) {
1942
+ CdkCellOutlet.mostRecentCellOutlet._viewContainer.createEmbeddedView(cellTemplate, context);
1943
+ }
1944
+ }
1945
+ this._changeDetectorRef.markForCheck();
1946
+ }
1947
+ _updateRowIndexContext() {
1948
+ const viewContainer = this._rowOutlet.viewContainer;
1949
+ for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) {
1950
+ const viewRef = viewContainer.get(renderIndex);
1951
+ const context = viewRef.context;
1952
+ context.count = count;
1953
+ context.first = renderIndex === 0;
1954
+ context.last = renderIndex === count - 1;
1955
+ context.even = renderIndex % 2 === 0;
1956
+ context.odd = !context.even;
1957
+ if (this.multiTemplateDataRows) {
1958
+ context.dataIndex = this._renderRows[renderIndex].dataIndex;
1959
+ context.renderIndex = renderIndex;
1960
+ } else {
1961
+ context.index = this._renderRows[renderIndex].dataIndex;
1962
+ }
1963
+ }
1964
+ }
1965
+ _getCellTemplates(rowDef) {
1966
+ if (!rowDef || !rowDef.columns) {
1967
+ return [];
1968
+ }
1969
+ return Array.from(rowDef.columns, columnId => {
1970
+ const column = this._columnDefsByName.get(columnId);
1971
+ if (!column && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1972
+ throw getTableUnknownColumnError(columnId);
1973
+ }
1974
+ return rowDef.extractCellTemplate(column);
1975
+ });
1976
+ }
1977
+ _forceRenderDataRows() {
1978
+ this._dataDiffer.diff([]);
1979
+ this._rowOutlet.viewContainer.clear();
1980
+ this.renderRows();
1981
+ }
1982
+ _checkStickyStates() {
1983
+ const stickyCheckReducer = (acc, d) => {
1984
+ return acc || d.hasStickyChanged();
1985
+ };
1986
+ if (this._headerRowDefs.reduce(stickyCheckReducer, false)) {
1987
+ this.updateStickyHeaderRowStyles();
1988
+ }
1989
+ if (this._footerRowDefs.reduce(stickyCheckReducer, false)) {
1990
+ this.updateStickyFooterRowStyles();
1991
+ }
1992
+ if (Array.from(this._columnDefsByName.values()).reduce(stickyCheckReducer, false)) {
1993
+ this._stickyColumnStylesNeedReset = true;
1994
+ this.updateStickyColumnStyles();
1995
+ }
1996
+ }
1997
+ _setupStickyStyler() {
1998
+ const direction = this._dir ? this._dir.value : 'ltr';
1999
+ this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, this.stickyCssClass, this._platform.isBrowser, this.needsPositionStickyOnElement, direction, this._stickyPositioningListener, this._injector);
2000
+ (this._dir ? this._dir.change : of()).pipe(takeUntil(this._onDestroy)).subscribe(value => {
2001
+ this._stickyStyler.direction = value;
2002
+ this.updateStickyColumnStyles();
2003
+ });
2004
+ }
2005
+ _getOwnDefs(items) {
2006
+ return items.filter(item => !item._table || item._table === this);
2007
+ }
2008
+ _updateNoDataRow() {
2009
+ const noDataRow = this._customNoDataRow || this._noDataRow;
2010
+ if (!noDataRow) {
2011
+ return;
2012
+ }
2013
+ const shouldShow = this._rowOutlet.viewContainer.length === 0;
2014
+ if (shouldShow === this._isShowingNoDataRow) {
2015
+ return;
2016
+ }
2017
+ const container = this._noDataRowOutlet.viewContainer;
2018
+ if (shouldShow) {
2019
+ const view = container.createEmbeddedView(noDataRow.templateRef);
2020
+ const rootNode = view.rootNodes[0];
2021
+ if (view.rootNodes.length === 1 && rootNode?.nodeType === this._document.ELEMENT_NODE) {
2022
+ rootNode.setAttribute('role', 'row');
2023
+ rootNode.classList.add(...noDataRow._contentClassNames);
2024
+ const cells = rootNode.querySelectorAll(noDataRow._cellSelector);
2025
+ for (let i = 0; i < cells.length; i++) {
2026
+ cells[i].classList.add(...noDataRow._cellClassNames);
2027
+ }
2028
+ }
2029
+ } else {
2030
+ container.clear();
2031
+ }
2032
+ this._isShowingNoDataRow = shouldShow;
2033
+ this._changeDetectorRef.markForCheck();
2034
+ }
2035
+ static ɵfac = i0.ɵɵngDeclareFactory({
2036
+ minVersion: "12.0.0",
2037
+ version: "20.2.0-next.2",
2038
+ ngImport: i0,
2039
+ type: CdkTable,
2040
+ deps: [],
2041
+ target: i0.ɵɵFactoryTarget.Component
2042
+ });
2043
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2044
+ minVersion: "17.0.0",
2045
+ version: "20.2.0-next.2",
2046
+ type: CdkTable,
2047
+ isStandalone: true,
2048
+ selector: "cdk-table, table[cdk-table]",
2049
+ inputs: {
2050
+ trackBy: "trackBy",
2051
+ dataSource: "dataSource",
2052
+ multiTemplateDataRows: ["multiTemplateDataRows", "multiTemplateDataRows", booleanAttribute],
2053
+ fixedLayout: ["fixedLayout", "fixedLayout", booleanAttribute]
2054
+ },
2055
+ outputs: {
2056
+ contentChanged: "contentChanged"
2057
+ },
2058
+ host: {
2059
+ properties: {
2060
+ "class.cdk-table-fixed-layout": "fixedLayout"
2061
+ },
2062
+ classAttribute: "cdk-table"
2063
+ },
2064
+ providers: [{
2065
+ provide: CDK_TABLE,
2066
+ useExisting: CdkTable
2067
+ }, {
2068
+ provide: _VIEW_REPEATER_STRATEGY,
2069
+ useClass: _DisposeViewRepeaterStrategy
2070
+ }, {
2071
+ provide: STICKY_POSITIONING_LISTENER,
2072
+ useValue: null
2073
+ }],
2074
+ queries: [{
2075
+ propertyName: "_noDataRow",
2076
+ first: true,
2077
+ predicate: CdkNoDataRow,
2078
+ descendants: true
2079
+ }, {
2080
+ propertyName: "_contentColumnDefs",
2081
+ predicate: CdkColumnDef,
2082
+ descendants: true
2083
+ }, {
2084
+ propertyName: "_contentRowDefs",
2085
+ predicate: CdkRowDef,
2086
+ descendants: true
2087
+ }, {
2088
+ propertyName: "_contentHeaderRowDefs",
2089
+ predicate: CdkHeaderRowDef,
2090
+ descendants: true
2091
+ }, {
2092
+ propertyName: "_contentFooterRowDefs",
2093
+ predicate: CdkFooterRowDef,
2094
+ descendants: true
2095
+ }],
2096
+ exportAs: ["cdkTable"],
2097
+ ngImport: i0,
2098
+ template: `
2144
2099
  <ng-content select="caption"/>
2145
2100
  <ng-content select="colgroup, col"/>
2146
2101
 
@@ -2169,11 +2124,41 @@ class CdkTable {
2169
2124
  <ng-container noDataRowOutlet/>
2170
2125
  <ng-container footerRowOutlet/>
2171
2126
  }
2172
- `, isInline: true, styles: [".cdk-table-fixed-layout{table-layout:fixed}\n"], dependencies: [{ kind: "directive", type: HeaderRowOutlet, selector: "[headerRowOutlet]" }, { kind: "directive", type: DataRowOutlet, selector: "[rowOutlet]" }, { kind: "directive", type: NoDataRowOutlet, selector: "[noDataRowOutlet]" }, { kind: "directive", type: FooterRowOutlet, selector: "[footerRowOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
2127
+ `,
2128
+ isInline: true,
2129
+ styles: [".cdk-table-fixed-layout{table-layout:fixed}\n"],
2130
+ dependencies: [{
2131
+ kind: "directive",
2132
+ type: HeaderRowOutlet,
2133
+ selector: "[headerRowOutlet]"
2134
+ }, {
2135
+ kind: "directive",
2136
+ type: DataRowOutlet,
2137
+ selector: "[rowOutlet]"
2138
+ }, {
2139
+ kind: "directive",
2140
+ type: NoDataRowOutlet,
2141
+ selector: "[noDataRowOutlet]"
2142
+ }, {
2143
+ kind: "directive",
2144
+ type: FooterRowOutlet,
2145
+ selector: "[footerRowOutlet]"
2146
+ }],
2147
+ changeDetection: i0.ChangeDetectionStrategy.Default,
2148
+ encapsulation: i0.ViewEncapsulation.None
2149
+ });
2173
2150
  }
2174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTable, decorators: [{
2175
- type: Component,
2176
- args: [{ selector: 'cdk-table, table[cdk-table]', exportAs: 'cdkTable', template: `
2151
+ i0.ɵɵngDeclareClassMetadata({
2152
+ minVersion: "12.0.0",
2153
+ version: "20.2.0-next.2",
2154
+ ngImport: i0,
2155
+ type: CdkTable,
2156
+ decorators: [{
2157
+ type: Component,
2158
+ args: [{
2159
+ selector: 'cdk-table, table[cdk-table]',
2160
+ exportAs: 'cdkTable',
2161
+ template: `
2177
2162
  <ng-content select="caption"/>
2178
2163
  <ng-content select="colgroup, col"/>
2179
2164
 
@@ -2202,179 +2187,199 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
2202
2187
  <ng-container noDataRowOutlet/>
2203
2188
  <ng-container footerRowOutlet/>
2204
2189
  }
2205
- `, host: {
2206
- 'class': 'cdk-table',
2207
- '[class.cdk-table-fixed-layout]': 'fixedLayout',
2208
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [
2209
- { provide: CDK_TABLE, useExisting: CdkTable },
2210
- { provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
2211
- // Prevent nested tables from seeing this table's StickyPositioningListener.
2212
- { provide: STICKY_POSITIONING_LISTENER, useValue: null },
2213
- ], imports: [HeaderRowOutlet, DataRowOutlet, NoDataRowOutlet, FooterRowOutlet], styles: [".cdk-table-fixed-layout{table-layout:fixed}\n"] }]
2214
- }], ctorParameters: () => [], propDecorators: { trackBy: [{
2215
- type: Input
2216
- }], dataSource: [{
2217
- type: Input
2218
- }], multiTemplateDataRows: [{
2219
- type: Input,
2220
- args: [{ transform: booleanAttribute }]
2221
- }], fixedLayout: [{
2222
- type: Input,
2223
- args: [{ transform: booleanAttribute }]
2224
- }], contentChanged: [{
2225
- type: Output
2226
- }], _contentColumnDefs: [{
2227
- type: ContentChildren,
2228
- args: [CdkColumnDef, { descendants: true }]
2229
- }], _contentRowDefs: [{
2230
- type: ContentChildren,
2231
- args: [CdkRowDef, { descendants: true }]
2232
- }], _contentHeaderRowDefs: [{
2233
- type: ContentChildren,
2234
- args: [CdkHeaderRowDef, {
2235
- descendants: true,
2236
- }]
2237
- }], _contentFooterRowDefs: [{
2238
- type: ContentChildren,
2239
- args: [CdkFooterRowDef, {
2240
- descendants: true,
2241
- }]
2242
- }], _noDataRow: [{
2243
- type: ContentChild,
2244
- args: [CdkNoDataRow]
2245
- }] } });
2246
- /** Utility function that gets a merged list of the entries in an array and values of a Set. */
2190
+ `,
2191
+ host: {
2192
+ 'class': 'cdk-table',
2193
+ '[class.cdk-table-fixed-layout]': 'fixedLayout'
2194
+ },
2195
+ encapsulation: ViewEncapsulation.None,
2196
+ changeDetection: ChangeDetectionStrategy.Default,
2197
+ providers: [{
2198
+ provide: CDK_TABLE,
2199
+ useExisting: CdkTable
2200
+ }, {
2201
+ provide: _VIEW_REPEATER_STRATEGY,
2202
+ useClass: _DisposeViewRepeaterStrategy
2203
+ }, {
2204
+ provide: STICKY_POSITIONING_LISTENER,
2205
+ useValue: null
2206
+ }],
2207
+ imports: [HeaderRowOutlet, DataRowOutlet, NoDataRowOutlet, FooterRowOutlet],
2208
+ styles: [".cdk-table-fixed-layout{table-layout:fixed}\n"]
2209
+ }]
2210
+ }],
2211
+ ctorParameters: () => [],
2212
+ propDecorators: {
2213
+ trackBy: [{
2214
+ type: Input
2215
+ }],
2216
+ dataSource: [{
2217
+ type: Input
2218
+ }],
2219
+ multiTemplateDataRows: [{
2220
+ type: Input,
2221
+ args: [{
2222
+ transform: booleanAttribute
2223
+ }]
2224
+ }],
2225
+ fixedLayout: [{
2226
+ type: Input,
2227
+ args: [{
2228
+ transform: booleanAttribute
2229
+ }]
2230
+ }],
2231
+ contentChanged: [{
2232
+ type: Output
2233
+ }],
2234
+ _contentColumnDefs: [{
2235
+ type: ContentChildren,
2236
+ args: [CdkColumnDef, {
2237
+ descendants: true
2238
+ }]
2239
+ }],
2240
+ _contentRowDefs: [{
2241
+ type: ContentChildren,
2242
+ args: [CdkRowDef, {
2243
+ descendants: true
2244
+ }]
2245
+ }],
2246
+ _contentHeaderRowDefs: [{
2247
+ type: ContentChildren,
2248
+ args: [CdkHeaderRowDef, {
2249
+ descendants: true
2250
+ }]
2251
+ }],
2252
+ _contentFooterRowDefs: [{
2253
+ type: ContentChildren,
2254
+ args: [CdkFooterRowDef, {
2255
+ descendants: true
2256
+ }]
2257
+ }],
2258
+ _noDataRow: [{
2259
+ type: ContentChild,
2260
+ args: [CdkNoDataRow]
2261
+ }]
2262
+ }
2263
+ });
2247
2264
  function mergeArrayAndSet(array, set) {
2248
- return array.concat(Array.from(set));
2265
+ return array.concat(Array.from(set));
2249
2266
  }
2250
- /**
2251
- * Finds the closest table section to an outlet. We can't use `HTMLElement.closest` for this,
2252
- * because the node representing the outlet is a comment.
2253
- */
2254
2267
  function closestTableSection(outlet, section) {
2255
- const uppercaseSection = section.toUpperCase();
2256
- let current = outlet.viewContainer.element.nativeElement;
2257
- while (current) {
2258
- // 1 is an element node.
2259
- const nodeName = current.nodeType === 1 ? current.nodeName : null;
2260
- if (nodeName === uppercaseSection) {
2261
- return current;
2262
- }
2263
- else if (nodeName === 'TABLE') {
2264
- // Stop traversing past the `table` node.
2265
- break;
2266
- }
2267
- current = current.parentNode;
2268
- }
2269
- return null;
2268
+ const uppercaseSection = section.toUpperCase();
2269
+ let current = outlet.viewContainer.element.nativeElement;
2270
+ while (current) {
2271
+ const nodeName = current.nodeType === 1 ? current.nodeName : null;
2272
+ if (nodeName === uppercaseSection) {
2273
+ return current;
2274
+ } else if (nodeName === 'TABLE') {
2275
+ break;
2276
+ }
2277
+ current = current.parentNode;
2278
+ }
2279
+ return null;
2270
2280
  }
2271
2281
 
2272
- /**
2273
- * Column that simply shows text content for the header and row cells. Assumes that the table
2274
- * is using the native table implementation (`<table>`).
2275
- *
2276
- * By default, the name of this column will be the header text and data property accessor.
2277
- * The header text can be overridden with the `headerText` input. Cell values can be overridden with
2278
- * the `dataAccessor` input. Change the text justification to the start or end using the `justify`
2279
- * input.
2280
- */
2281
2282
  class CdkTextColumn {
2282
- _table = inject(CdkTable, { optional: true });
2283
- _options = inject(TEXT_COLUMN_OPTIONS, { optional: true });
2284
- /** Column name that should be used to reference this column. */
2285
- get name() {
2286
- return this._name;
2287
- }
2288
- set name(name) {
2289
- this._name = name;
2290
- // With Ivy, inputs can be initialized before static query results are
2291
- // available. In that case, we defer the synchronization until "ngOnInit" fires.
2292
- this._syncColumnDefName();
2293
- }
2294
- _name;
2295
- /**
2296
- * Text label that should be used for the column header. If this property is not
2297
- * set, the header text will default to the column name with its first letter capitalized.
2298
- */
2299
- headerText;
2300
- /**
2301
- * Accessor function to retrieve the data rendered for each cell. If this
2302
- * property is not set, the data cells will render the value found in the data's property matching
2303
- * the column's name. For example, if the column is named `id`, then the rendered value will be
2304
- * value defined by the data's `id` property.
2305
- */
2306
- dataAccessor;
2307
- /** Alignment of the cell values. */
2308
- justify = 'start';
2309
- /** @docs-private */
2310
- columnDef;
2311
- /**
2312
- * The column cell is provided to the column during `ngOnInit` with a static query.
2313
- * Normally, this will be retrieved by the column using `ContentChild`, but that assumes the
2314
- * column definition was provided in the same view as the table, which is not the case with this
2315
- * component.
2316
- * @docs-private
2317
- */
2318
- cell;
2319
- /**
2320
- * The column headerCell is provided to the column during `ngOnInit` with a static query.
2321
- * Normally, this will be retrieved by the column using `ContentChild`, but that assumes the
2322
- * column definition was provided in the same view as the table, which is not the case with this
2323
- * component.
2324
- * @docs-private
2325
- */
2326
- headerCell;
2327
- constructor() {
2328
- this._options = this._options || {};
2329
- }
2330
- ngOnInit() {
2331
- this._syncColumnDefName();
2332
- if (this.headerText === undefined) {
2333
- this.headerText = this._createDefaultHeaderText();
2334
- }
2335
- if (!this.dataAccessor) {
2336
- this.dataAccessor =
2337
- this._options.defaultDataAccessor || ((data, name) => data[name]);
2338
- }
2339
- if (this._table) {
2340
- // Provide the cell and headerCell directly to the table with the static `ViewChild` query,
2341
- // since the columnDef will not pick up its content by the time the table finishes checking
2342
- // its content and initializing the rows.
2343
- this.columnDef.cell = this.cell;
2344
- this.columnDef.headerCell = this.headerCell;
2345
- this._table.addColumnDef(this.columnDef);
2346
- }
2347
- else if (typeof ngDevMode === 'undefined' || ngDevMode) {
2348
- throw getTableTextColumnMissingParentTableError();
2349
- }
2350
- }
2351
- ngOnDestroy() {
2352
- if (this._table) {
2353
- this._table.removeColumnDef(this.columnDef);
2354
- }
2355
- }
2356
- /**
2357
- * Creates a default header text. Use the options' header text transformation function if one
2358
- * has been provided. Otherwise simply capitalize the column name.
2359
- */
2360
- _createDefaultHeaderText() {
2361
- const name = this.name;
2362
- if (!name && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2363
- throw getTableTextColumnMissingNameError();
2364
- }
2365
- if (this._options && this._options.defaultHeaderTextTransform) {
2366
- return this._options.defaultHeaderTextTransform(name);
2367
- }
2368
- return name[0].toUpperCase() + name.slice(1);
2369
- }
2370
- /** Synchronizes the column definition name with the text column name. */
2371
- _syncColumnDefName() {
2372
- if (this.columnDef) {
2373
- this.columnDef.name = this.name;
2374
- }
2375
- }
2376
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTextColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
2377
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkTextColumn, isStandalone: true, selector: "cdk-text-column", inputs: { name: "name", headerText: "headerText", dataAccessor: "dataAccessor", justify: "justify" }, viewQueries: [{ propertyName: "columnDef", first: true, predicate: CdkColumnDef, descendants: true, static: true }, { propertyName: "cell", first: true, predicate: CdkCellDef, descendants: true, static: true }, { propertyName: "headerCell", first: true, predicate: CdkHeaderCellDef, descendants: true, static: true }], ngImport: i0, template: `
2283
+ _table = inject(CdkTable, {
2284
+ optional: true
2285
+ });
2286
+ _options = inject(TEXT_COLUMN_OPTIONS, {
2287
+ optional: true
2288
+ });
2289
+ get name() {
2290
+ return this._name;
2291
+ }
2292
+ set name(name) {
2293
+ this._name = name;
2294
+ this._syncColumnDefName();
2295
+ }
2296
+ _name;
2297
+ headerText;
2298
+ dataAccessor;
2299
+ justify = 'start';
2300
+ columnDef;
2301
+ cell;
2302
+ headerCell;
2303
+ constructor() {
2304
+ this._options = this._options || {};
2305
+ }
2306
+ ngOnInit() {
2307
+ this._syncColumnDefName();
2308
+ if (this.headerText === undefined) {
2309
+ this.headerText = this._createDefaultHeaderText();
2310
+ }
2311
+ if (!this.dataAccessor) {
2312
+ this.dataAccessor = this._options.defaultDataAccessor || ((data, name) => data[name]);
2313
+ }
2314
+ if (this._table) {
2315
+ this.columnDef.cell = this.cell;
2316
+ this.columnDef.headerCell = this.headerCell;
2317
+ this._table.addColumnDef(this.columnDef);
2318
+ } else if (typeof ngDevMode === 'undefined' || ngDevMode) {
2319
+ throw getTableTextColumnMissingParentTableError();
2320
+ }
2321
+ }
2322
+ ngOnDestroy() {
2323
+ if (this._table) {
2324
+ this._table.removeColumnDef(this.columnDef);
2325
+ }
2326
+ }
2327
+ _createDefaultHeaderText() {
2328
+ const name = this.name;
2329
+ if (!name && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2330
+ throw getTableTextColumnMissingNameError();
2331
+ }
2332
+ if (this._options && this._options.defaultHeaderTextTransform) {
2333
+ return this._options.defaultHeaderTextTransform(name);
2334
+ }
2335
+ return name[0].toUpperCase() + name.slice(1);
2336
+ }
2337
+ _syncColumnDefName() {
2338
+ if (this.columnDef) {
2339
+ this.columnDef.name = this.name;
2340
+ }
2341
+ }
2342
+ static ɵfac = i0.ɵɵngDeclareFactory({
2343
+ minVersion: "12.0.0",
2344
+ version: "20.2.0-next.2",
2345
+ ngImport: i0,
2346
+ type: CdkTextColumn,
2347
+ deps: [],
2348
+ target: i0.ɵɵFactoryTarget.Component
2349
+ });
2350
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2351
+ minVersion: "14.0.0",
2352
+ version: "20.2.0-next.2",
2353
+ type: CdkTextColumn,
2354
+ isStandalone: true,
2355
+ selector: "cdk-text-column",
2356
+ inputs: {
2357
+ name: "name",
2358
+ headerText: "headerText",
2359
+ dataAccessor: "dataAccessor",
2360
+ justify: "justify"
2361
+ },
2362
+ viewQueries: [{
2363
+ propertyName: "columnDef",
2364
+ first: true,
2365
+ predicate: CdkColumnDef,
2366
+ descendants: true,
2367
+ static: true
2368
+ }, {
2369
+ propertyName: "cell",
2370
+ first: true,
2371
+ predicate: CdkCellDef,
2372
+ descendants: true,
2373
+ static: true
2374
+ }, {
2375
+ propertyName: "headerCell",
2376
+ first: true,
2377
+ predicate: CdkHeaderCellDef,
2378
+ descendants: true,
2379
+ static: true
2380
+ }],
2381
+ ngImport: i0,
2382
+ template: `
2378
2383
  <ng-container cdkColumnDef>
2379
2384
  <th cdk-header-cell *cdkHeaderCellDef [style.text-align]="justify">
2380
2385
  {{headerText}}
@@ -2383,13 +2388,44 @@ class CdkTextColumn {
2383
2388
  {{dataAccessor(data, name)}}
2384
2389
  </td>
2385
2390
  </ng-container>
2386
- `, 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 });
2391
+ `,
2392
+ isInline: true,
2393
+ dependencies: [{
2394
+ kind: "directive",
2395
+ type: CdkColumnDef,
2396
+ selector: "[cdkColumnDef]",
2397
+ inputs: ["cdkColumnDef", "sticky", "stickyEnd"]
2398
+ }, {
2399
+ kind: "directive",
2400
+ type: CdkHeaderCellDef,
2401
+ selector: "[cdkHeaderCellDef]"
2402
+ }, {
2403
+ kind: "directive",
2404
+ type: CdkHeaderCell,
2405
+ selector: "cdk-header-cell, th[cdk-header-cell]"
2406
+ }, {
2407
+ kind: "directive",
2408
+ type: CdkCellDef,
2409
+ selector: "[cdkCellDef]"
2410
+ }, {
2411
+ kind: "directive",
2412
+ type: CdkCell,
2413
+ selector: "cdk-cell, td[cdk-cell]"
2414
+ }],
2415
+ changeDetection: i0.ChangeDetectionStrategy.Default,
2416
+ encapsulation: i0.ViewEncapsulation.None
2417
+ });
2387
2418
  }
2388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTextColumn, decorators: [{
2389
- type: Component,
2390
- args: [{
2391
- selector: 'cdk-text-column',
2392
- template: `
2419
+ i0.ɵɵngDeclareClassMetadata({
2420
+ minVersion: "12.0.0",
2421
+ version: "20.2.0-next.2",
2422
+ ngImport: i0,
2423
+ type: CdkTextColumn,
2424
+ decorators: [{
2425
+ type: Component,
2426
+ args: [{
2427
+ selector: 'cdk-text-column',
2428
+ template: `
2393
2429
  <ng-container cdkColumnDef>
2394
2430
  <th cdk-header-cell *cdkHeaderCellDef [style.text-align]="justify">
2395
2431
  {{headerText}}
@@ -2399,113 +2435,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2",
2399
2435
  </td>
2400
2436
  </ng-container>
2401
2437
  `,
2402
- encapsulation: ViewEncapsulation.None,
2403
- // Change detection is intentionally not set to OnPush. This component's template will be provided
2404
- // to the table to be inserted into its view. This is problematic when change detection runs since
2405
- // the bindings in this template will be evaluated _after_ the table's view is evaluated, which
2406
- // mean's the template in the table's view will not have the updated value (and in fact will cause
2407
- // an ExpressionChangedAfterItHasBeenCheckedError).
2408
- // tslint:disable-next-line:validate-decorators
2409
- changeDetection: ChangeDetectionStrategy.Default,
2410
- imports: [CdkColumnDef, CdkHeaderCellDef, CdkHeaderCell, CdkCellDef, CdkCell],
2411
- }]
2412
- }], ctorParameters: () => [], propDecorators: { name: [{
2413
- type: Input
2414
- }], headerText: [{
2415
- type: Input
2416
- }], dataAccessor: [{
2417
- type: Input
2418
- }], justify: [{
2419
- type: Input
2420
- }], columnDef: [{
2421
- type: ViewChild,
2422
- args: [CdkColumnDef, { static: true }]
2423
- }], cell: [{
2424
- type: ViewChild,
2425
- args: [CdkCellDef, { static: true }]
2426
- }], headerCell: [{
2427
- type: ViewChild,
2428
- args: [CdkHeaderCellDef, { static: true }]
2429
- }] } });
2438
+ encapsulation: ViewEncapsulation.None,
2439
+ changeDetection: ChangeDetectionStrategy.Default,
2440
+ imports: [CdkColumnDef, CdkHeaderCellDef, CdkHeaderCell, CdkCellDef, CdkCell]
2441
+ }]
2442
+ }],
2443
+ ctorParameters: () => [],
2444
+ propDecorators: {
2445
+ name: [{
2446
+ type: Input
2447
+ }],
2448
+ headerText: [{
2449
+ type: Input
2450
+ }],
2451
+ dataAccessor: [{
2452
+ type: Input
2453
+ }],
2454
+ justify: [{
2455
+ type: Input
2456
+ }],
2457
+ columnDef: [{
2458
+ type: ViewChild,
2459
+ args: [CdkColumnDef, {
2460
+ static: true
2461
+ }]
2462
+ }],
2463
+ cell: [{
2464
+ type: ViewChild,
2465
+ args: [CdkCellDef, {
2466
+ static: true
2467
+ }]
2468
+ }],
2469
+ headerCell: [{
2470
+ type: ViewChild,
2471
+ args: [CdkHeaderCellDef, {
2472
+ static: true
2473
+ }]
2474
+ }]
2475
+ }
2476
+ });
2430
2477
 
2431
- const EXPORTED_DECLARATIONS = [
2432
- CdkTable,
2433
- CdkRowDef,
2434
- CdkCellDef,
2435
- CdkCellOutlet,
2436
- CdkHeaderCellDef,
2437
- CdkFooterCellDef,
2438
- CdkColumnDef,
2439
- CdkCell,
2440
- CdkRow,
2441
- CdkHeaderCell,
2442
- CdkFooterCell,
2443
- CdkHeaderRow,
2444
- CdkHeaderRowDef,
2445
- CdkFooterRow,
2446
- CdkFooterRowDef,
2447
- DataRowOutlet,
2448
- HeaderRowOutlet,
2449
- FooterRowOutlet,
2450
- CdkTextColumn,
2451
- CdkNoDataRow,
2452
- CdkRecycleRows,
2453
- NoDataRowOutlet,
2454
- ];
2478
+ const EXPORTED_DECLARATIONS = [CdkTable, CdkRowDef, CdkCellDef, CdkCellOutlet, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkCell, CdkRow, CdkHeaderCell, CdkFooterCell, CdkHeaderRow, CdkHeaderRowDef, CdkFooterRow, CdkFooterRowDef, DataRowOutlet, HeaderRowOutlet, FooterRowOutlet, CdkTextColumn, CdkNoDataRow, CdkRecycleRows, NoDataRowOutlet];
2455
2479
  class CdkTableModule {
2456
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2457
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTableModule, imports: [ScrollingModule, CdkTable,
2458
- CdkRowDef,
2459
- CdkCellDef,
2460
- CdkCellOutlet,
2461
- CdkHeaderCellDef,
2462
- CdkFooterCellDef,
2463
- CdkColumnDef,
2464
- CdkCell,
2465
- CdkRow,
2466
- CdkHeaderCell,
2467
- CdkFooterCell,
2468
- CdkHeaderRow,
2469
- CdkHeaderRowDef,
2470
- CdkFooterRow,
2471
- CdkFooterRowDef,
2472
- DataRowOutlet,
2473
- HeaderRowOutlet,
2474
- FooterRowOutlet,
2475
- CdkTextColumn,
2476
- CdkNoDataRow,
2477
- CdkRecycleRows,
2478
- NoDataRowOutlet], exports: [CdkTable,
2479
- CdkRowDef,
2480
- CdkCellDef,
2481
- CdkCellOutlet,
2482
- CdkHeaderCellDef,
2483
- CdkFooterCellDef,
2484
- CdkColumnDef,
2485
- CdkCell,
2486
- CdkRow,
2487
- CdkHeaderCell,
2488
- CdkFooterCell,
2489
- CdkHeaderRow,
2490
- CdkHeaderRowDef,
2491
- CdkFooterRow,
2492
- CdkFooterRowDef,
2493
- DataRowOutlet,
2494
- HeaderRowOutlet,
2495
- FooterRowOutlet,
2496
- CdkTextColumn,
2497
- CdkNoDataRow,
2498
- CdkRecycleRows,
2499
- NoDataRowOutlet] });
2500
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTableModule, imports: [ScrollingModule] });
2480
+ static ɵfac = i0.ɵɵngDeclareFactory({
2481
+ minVersion: "12.0.0",
2482
+ version: "20.2.0-next.2",
2483
+ ngImport: i0,
2484
+ type: CdkTableModule,
2485
+ deps: [],
2486
+ target: i0.ɵɵFactoryTarget.NgModule
2487
+ });
2488
+ static ɵmod = i0.ɵɵngDeclareNgModule({
2489
+ minVersion: "14.0.0",
2490
+ version: "20.2.0-next.2",
2491
+ ngImport: i0,
2492
+ type: CdkTableModule,
2493
+ imports: [ScrollingModule, CdkTable, CdkRowDef, CdkCellDef, CdkCellOutlet, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkCell, CdkRow, CdkHeaderCell, CdkFooterCell, CdkHeaderRow, CdkHeaderRowDef, CdkFooterRow, CdkFooterRowDef, DataRowOutlet, HeaderRowOutlet, FooterRowOutlet, CdkTextColumn, CdkNoDataRow, CdkRecycleRows, NoDataRowOutlet],
2494
+ exports: [CdkTable, CdkRowDef, CdkCellDef, CdkCellOutlet, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkCell, CdkRow, CdkHeaderCell, CdkFooterCell, CdkHeaderRow, CdkHeaderRowDef, CdkFooterRow, CdkFooterRowDef, DataRowOutlet, HeaderRowOutlet, FooterRowOutlet, CdkTextColumn, CdkNoDataRow, CdkRecycleRows, NoDataRowOutlet]
2495
+ });
2496
+ static ɵinj = i0.ɵɵngDeclareInjector({
2497
+ minVersion: "12.0.0",
2498
+ version: "20.2.0-next.2",
2499
+ ngImport: i0,
2500
+ type: CdkTableModule,
2501
+ imports: [ScrollingModule]
2502
+ });
2501
2503
  }
2502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkTableModule, decorators: [{
2503
- type: NgModule,
2504
- args: [{
2505
- exports: EXPORTED_DECLARATIONS,
2506
- imports: [ScrollingModule, ...EXPORTED_DECLARATIONS],
2507
- }]
2508
- }] });
2504
+ i0.ɵɵngDeclareClassMetadata({
2505
+ minVersion: "12.0.0",
2506
+ version: "20.2.0-next.2",
2507
+ ngImport: i0,
2508
+ type: CdkTableModule,
2509
+ decorators: [{
2510
+ type: NgModule,
2511
+ args: [{
2512
+ exports: EXPORTED_DECLARATIONS,
2513
+ imports: [ScrollingModule, ...EXPORTED_DECLARATIONS]
2514
+ }]
2515
+ }]
2516
+ });
2509
2517
 
2510
2518
  export { BaseCdkCell, BaseRowDef, CDK_ROW_TEMPLATE, CDK_TABLE, CdkCell, CdkCellDef, CdkCellOutlet, CdkColumnDef, CdkFooterCell, CdkFooterCellDef, CdkFooterRow, CdkFooterRowDef, CdkHeaderCell, CdkHeaderCellDef, CdkHeaderRow, CdkHeaderRowDef, CdkNoDataRow, CdkRecycleRows, CdkRow, CdkRowDef, CdkTable, CdkTableModule, CdkTextColumn, DataRowOutlet, FooterRowOutlet, HeaderRowOutlet, NoDataRowOutlet, STICKY_POSITIONING_LISTENER, TEXT_COLUMN_OPTIONS };
2511
2519
  //# sourceMappingURL=table.mjs.map