@vaadin/grid 24.3.0-alpha1 → 24.3.0-alpha11

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 (114) hide show
  1. package/package.json +12 -12
  2. package/src/lit-all-imports.js +14 -0
  3. package/src/vaadin-grid-a11y-mixin.js +1 -1
  4. package/src/vaadin-grid-active-item-mixin.js +1 -0
  5. package/src/vaadin-grid-array-data-provider-mixin.js +14 -17
  6. package/src/vaadin-grid-column-group-mixin.d.ts +20 -0
  7. package/src/vaadin-grid-column-group-mixin.js +364 -0
  8. package/src/vaadin-grid-column-group.d.ts +4 -14
  9. package/src/vaadin-grid-column-group.js +5 -355
  10. package/src/vaadin-grid-column-mixin.d.ts +170 -0
  11. package/src/vaadin-grid-column-mixin.js +958 -0
  12. package/src/vaadin-grid-column.d.ts +11 -138
  13. package/src/vaadin-grid-column.js +5 -876
  14. package/src/vaadin-grid-data-provider-mixin.d.ts +6 -5
  15. package/src/vaadin-grid-data-provider-mixin.js +62 -12
  16. package/src/vaadin-grid-drag-and-drop-mixin.js +17 -5
  17. package/src/vaadin-grid-dynamic-columns-mixin.js +22 -17
  18. package/src/vaadin-grid-filter-column-mixin.d.ts +22 -0
  19. package/src/vaadin-grid-filter-column-mixin.js +106 -0
  20. package/src/vaadin-grid-filter-column.d.ts +9 -11
  21. package/src/vaadin-grid-filter-column.js +3 -90
  22. package/src/vaadin-grid-filter-element-mixin.d.ts +34 -0
  23. package/src/vaadin-grid-filter-element-mixin.js +108 -0
  24. package/src/vaadin-grid-filter-mixin.js +4 -4
  25. package/src/vaadin-grid-filter.d.ts +4 -21
  26. package/src/vaadin-grid-filter.js +5 -84
  27. package/src/vaadin-grid-helpers.js +94 -0
  28. package/src/vaadin-grid-keyboard-navigation-mixin.js +26 -6
  29. package/src/vaadin-grid-mixin.js +37 -46
  30. package/src/vaadin-grid-row-details-mixin.js +14 -8
  31. package/src/vaadin-grid-scroll-mixin.js +9 -3
  32. package/src/vaadin-grid-selection-column-base-mixin.js +12 -4
  33. package/src/vaadin-grid-selection-column-mixin.d.ts +24 -0
  34. package/src/vaadin-grid-selection-column-mixin.js +194 -0
  35. package/src/vaadin-grid-selection-column.d.ts +13 -17
  36. package/src/vaadin-grid-selection-column.js +4 -186
  37. package/src/vaadin-grid-selection-mixin.js +4 -3
  38. package/src/vaadin-grid-sort-column-mixin.d.ts +36 -0
  39. package/src/vaadin-grid-sort-column-mixin.js +101 -0
  40. package/src/vaadin-grid-sort-column.d.ts +8 -26
  41. package/src/vaadin-grid-sort-column.js +3 -87
  42. package/src/vaadin-grid-sorter-mixin.d.ts +44 -0
  43. package/src/vaadin-grid-sorter-mixin.js +200 -0
  44. package/src/vaadin-grid-sorter.d.ts +3 -32
  45. package/src/vaadin-grid-sorter.js +5 -181
  46. package/src/vaadin-grid-styles.js +341 -345
  47. package/src/vaadin-grid-styling-mixin.js +8 -2
  48. package/src/vaadin-grid-tree-column-mixin.d.ts +18 -0
  49. package/src/vaadin-grid-tree-column-mixin.js +99 -0
  50. package/src/vaadin-grid-tree-column.d.ts +9 -7
  51. package/src/vaadin-grid-tree-column.js +3 -82
  52. package/src/vaadin-grid-tree-toggle-mixin.d.ts +39 -0
  53. package/src/vaadin-grid-tree-toggle-mixin.js +153 -0
  54. package/src/vaadin-grid-tree-toggle.d.ts +4 -27
  55. package/src/vaadin-grid-tree-toggle.js +9 -141
  56. package/src/vaadin-grid.d.ts +3 -0
  57. package/src/vaadin-grid.js +7 -2
  58. package/src/vaadin-lit-grid-column-group.js +28 -0
  59. package/src/vaadin-lit-grid-column.js +30 -0
  60. package/src/vaadin-lit-grid-filter-column.js +28 -0
  61. package/src/vaadin-lit-grid-filter.js +35 -0
  62. package/src/vaadin-lit-grid-selection-column.js +28 -0
  63. package/src/vaadin-lit-grid-sort-column.js +28 -0
  64. package/src/vaadin-lit-grid-sorter.js +42 -0
  65. package/src/vaadin-lit-grid-tree-column.js +28 -0
  66. package/src/vaadin-lit-grid-tree-toggle.js +39 -0
  67. package/src/vaadin-lit-grid.js +63 -0
  68. package/theme/lumo/lit-all-imports.js +11 -0
  69. package/theme/lumo/vaadin-grid-sorter-styles.js +1 -1
  70. package/theme/lumo/vaadin-grid-styles.js +15 -14
  71. package/theme/lumo/vaadin-lit-grid-column-group.js +1 -0
  72. package/theme/lumo/vaadin-lit-grid-column.js +1 -0
  73. package/theme/lumo/vaadin-lit-grid-filter-column.js +2 -0
  74. package/theme/lumo/vaadin-lit-grid-filter.js +3 -0
  75. package/theme/lumo/vaadin-lit-grid-selection-column.js +2 -0
  76. package/theme/lumo/vaadin-lit-grid-sort-column.js +2 -0
  77. package/theme/lumo/vaadin-lit-grid-sorter.js +2 -0
  78. package/theme/lumo/vaadin-lit-grid-tree-column.js +2 -0
  79. package/theme/lumo/vaadin-lit-grid-tree-toggle.js +2 -0
  80. package/theme/lumo/vaadin-lit-grid.js +2 -0
  81. package/theme/material/lit-all-imports.js +11 -0
  82. package/theme/material/vaadin-grid-styles.js +15 -10
  83. package/theme/material/vaadin-lit-grid-column-group.js +1 -0
  84. package/theme/material/vaadin-lit-grid-column.js +1 -0
  85. package/theme/material/vaadin-lit-grid-filter-column.js +2 -0
  86. package/theme/material/vaadin-lit-grid-filter.js +3 -0
  87. package/theme/material/vaadin-lit-grid-selection-column.js +2 -0
  88. package/theme/material/vaadin-lit-grid-sort-column.js +2 -0
  89. package/theme/material/vaadin-lit-grid-sorter.js +2 -0
  90. package/theme/material/vaadin-lit-grid-tree-column.js +2 -0
  91. package/theme/material/vaadin-lit-grid-tree-toggle.js +2 -0
  92. package/theme/material/vaadin-lit-grid.js +2 -0
  93. package/vaadin-lit-grid-column-group.d.ts +1 -0
  94. package/vaadin-lit-grid-column-group.js +3 -0
  95. package/vaadin-lit-grid-column.d.ts +1 -0
  96. package/vaadin-lit-grid-column.js +3 -0
  97. package/vaadin-lit-grid-filter-column.d.ts +1 -0
  98. package/vaadin-lit-grid-filter-column.js +3 -0
  99. package/vaadin-lit-grid-filter.d.ts +1 -0
  100. package/vaadin-lit-grid-filter.js +3 -0
  101. package/vaadin-lit-grid-selection-column.d.ts +1 -0
  102. package/vaadin-lit-grid-selection-column.js +3 -0
  103. package/vaadin-lit-grid-sort-column.d.ts +1 -0
  104. package/vaadin-lit-grid-sort-column.js +3 -0
  105. package/vaadin-lit-grid-sorter.d.ts +1 -0
  106. package/vaadin-lit-grid-sorter.js +3 -0
  107. package/vaadin-lit-grid-tree-column.d.ts +1 -0
  108. package/vaadin-lit-grid-tree-column.js +3 -0
  109. package/vaadin-lit-grid-tree-toggle.d.ts +1 -0
  110. package/vaadin-lit-grid-tree-toggle.js +3 -0
  111. package/vaadin-lit-grid.d.ts +2 -0
  112. package/vaadin-lit-grid.js +4 -0
  113. package/web-types.json +331 -126
  114. package/web-types.lit.json +114 -58
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "24.3.0-alpha1",
3
+ "version": "24.3.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,24 +46,24 @@
46
46
  "dependencies": {
47
47
  "@open-wc/dedupe-mixin": "^1.3.0",
48
48
  "@polymer/polymer": "^3.0.0",
49
- "@vaadin/a11y-base": "24.3.0-alpha1",
50
- "@vaadin/checkbox": "24.3.0-alpha1",
51
- "@vaadin/component-base": "24.3.0-alpha1",
52
- "@vaadin/lit-renderer": "24.3.0-alpha1",
53
- "@vaadin/text-field": "24.3.0-alpha1",
54
- "@vaadin/vaadin-lumo-styles": "24.3.0-alpha1",
55
- "@vaadin/vaadin-material-styles": "24.3.0-alpha1",
56
- "@vaadin/vaadin-themable-mixin": "24.3.0-alpha1"
49
+ "@vaadin/a11y-base": "24.3.0-alpha11",
50
+ "@vaadin/checkbox": "24.3.0-alpha11",
51
+ "@vaadin/component-base": "24.3.0-alpha11",
52
+ "@vaadin/lit-renderer": "24.3.0-alpha11",
53
+ "@vaadin/text-field": "24.3.0-alpha11",
54
+ "@vaadin/vaadin-lumo-styles": "24.3.0-alpha11",
55
+ "@vaadin/vaadin-material-styles": "24.3.0-alpha11",
56
+ "@vaadin/vaadin-themable-mixin": "24.3.0-alpha11"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@esm-bundle/chai": "^4.3.4",
60
- "@vaadin/testing-helpers": "^0.5.0",
61
- "lit": "^2.0.0",
60
+ "@vaadin/testing-helpers": "^0.6.0",
61
+ "lit": "^3.0.0",
62
62
  "sinon": "^13.0.2"
63
63
  },
64
64
  "web-types": [
65
65
  "web-types.json",
66
66
  "web-types.lit.json"
67
67
  ],
68
- "gitHead": "9ca6f3ca220a777e8eea181a1f5717e39a732240"
68
+ "gitHead": "123cf569a1b6ef6f4ef5fe8e60cb8d988699b98c"
69
69
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import './vaadin-lit-grid.js';
7
+ import './vaadin-lit-grid-column-group.js';
8
+ import './vaadin-lit-grid-filter.js';
9
+ import './vaadin-lit-grid-filter-column.js';
10
+ import './vaadin-lit-grid-sorter.js';
11
+ import './vaadin-lit-grid-sort-column.js';
12
+ import './vaadin-lit-grid-selection-column.js';
13
+ import './vaadin-lit-grid-tree-toggle.js';
14
+ import './vaadin-lit-grid-tree-column.js';
@@ -11,7 +11,7 @@ import { iterateChildren, iterateRowCells } from './vaadin-grid-helpers.js';
11
11
  export const A11yMixin = (superClass) =>
12
12
  class A11yMixin extends superClass {
13
13
  static get observers() {
14
- return ['_a11yUpdateGridSize(size, _columnTree, _columnTree.*)'];
14
+ return ['_a11yUpdateGridSize(size, _columnTree)'];
15
15
  }
16
16
 
17
17
  /** @private */
@@ -44,6 +44,7 @@ export const ActiveItemMixin = (superClass) =>
44
44
  type: Object,
45
45
  notify: true,
46
46
  value: null,
47
+ sync: true,
47
48
  },
48
49
  };
49
50
  }
@@ -17,23 +17,24 @@ export const ArrayDataProviderMixin = (superClass) =>
17
17
  *
18
18
  * @type {Array<!GridItem> | undefined}
19
19
  */
20
- items: Array,
20
+ items: {
21
+ type: Array,
22
+ sync: true,
23
+ },
21
24
  };
22
25
  }
23
26
 
24
27
  static get observers() {
25
- return ['__dataProviderOrItemsChanged(dataProvider, items, isAttached, items.*, _filters, _sorters)'];
28
+ return ['__dataProviderOrItemsChanged(dataProvider, items, isAttached, _filters, _sorters, items.*)'];
26
29
  }
27
30
 
28
31
  /** @private */
29
32
  __setArrayDataProvider(items) {
30
33
  const arrayDataProvider = createArrayDataProvider(this.items, {});
31
34
  arrayDataProvider.__items = items;
32
- this.setProperties({
33
- _arrayDataProvider: arrayDataProvider,
34
- size: items.length,
35
- dataProvider: arrayDataProvider,
36
- });
35
+ this._arrayDataProvider = arrayDataProvider;
36
+ this.size = items.length;
37
+ this.dataProvider = arrayDataProvider;
37
38
  }
38
39
 
39
40
  /** @private */
@@ -47,22 +48,18 @@ export const ArrayDataProviderMixin = (superClass) =>
47
48
 
48
49
  if (dataProvider !== this._arrayDataProvider) {
49
50
  // A custom data provider was set externally
50
- this.setProperties({
51
- _arrayDataProvider: undefined,
52
- items: undefined,
53
- });
51
+ this._arrayDataProvider = undefined;
52
+ this.items = undefined;
54
53
  } else if (!items) {
55
54
  // The items array was unset
56
- this.setProperties({
57
- _arrayDataProvider: undefined,
58
- dataProvider: undefined,
59
- size: 0,
60
- });
55
+ this._arrayDataProvider = undefined;
56
+ this.dataProvider = undefined;
57
+ this.size = 0;
61
58
  this.clearCache();
62
59
  } else if (this._arrayDataProvider.__items === items) {
63
60
  // The items array was modified
64
61
  this.clearCache();
65
- this.size = this._effectiveSize;
62
+ this.size = this._flatSize;
66
63
  } else {
67
64
  // The items array was replaced
68
65
  this.__setArrayDataProvider(items);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { ColumnBaseMixinClass } from './vaadin-grid-column.js';
7
+
8
+ export interface GridColumnGroupMixin<TItem, Column extends ColumnBaseMixinClass<TItem, Column>>
9
+ extends ColumnBaseMixinClass<TItem, Column> {
10
+ /**
11
+ * Flex grow ratio for the column group as the sum of the ratios of its child columns.
12
+ * @attr {number} flex-grow
13
+ */
14
+ readonly flexGrow: number | null | undefined;
15
+
16
+ /**
17
+ * Width of the column group as the sum of the widths of its child columns.
18
+ */
19
+ readonly width: string | null | undefined;
20
+ }
@@ -0,0 +1,364 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { animationFrame } from '@vaadin/component-base/src/async.js';
7
+ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
+ import { ColumnBaseMixin } from './vaadin-grid-column-mixin.js';
9
+ import { ColumnObserver, updateColumnOrders } from './vaadin-grid-helpers.js';
10
+
11
+ /**
12
+ * A mixin providing common vaadin-grid-column-group functionality.
13
+ *
14
+ * @polymerMixin
15
+ * @mixes ColumnBaseMixin
16
+ */
17
+ export const GridColumnGroupMixin = (superClass) =>
18
+ class extends ColumnBaseMixin(superClass) {
19
+ static get properties() {
20
+ return {
21
+ /** @private */
22
+ _childColumns: {
23
+ value() {
24
+ return this._getChildColumns(this);
25
+ },
26
+ },
27
+
28
+ /**
29
+ * Flex grow ratio for the column group as the sum of the ratios of its child columns.
30
+ * @attr {number} flex-grow
31
+ */
32
+ flexGrow: {
33
+ type: Number,
34
+ readOnly: true,
35
+ sync: true,
36
+ },
37
+
38
+ /**
39
+ * Width of the column group as the sum of the widths of its child columns.
40
+ */
41
+ width: {
42
+ type: String,
43
+ readOnly: true,
44
+ },
45
+
46
+ /** @private */
47
+ _visibleChildColumns: Array,
48
+
49
+ /** @private */
50
+ _colSpan: Number,
51
+
52
+ /** @private */
53
+ _rootColumns: Array,
54
+ };
55
+ }
56
+
57
+ static get observers() {
58
+ return [
59
+ '_groupFrozenChanged(frozen, _rootColumns)',
60
+ '_groupFrozenToEndChanged(frozenToEnd, _rootColumns)',
61
+ '_groupHiddenChanged(hidden)',
62
+ '_colSpanChanged(_colSpan, _headerCell, _footerCell)',
63
+ '_groupOrderChanged(_order, _rootColumns)',
64
+ '_groupReorderStatusChanged(_reorderStatus, _rootColumns)',
65
+ '_groupResizableChanged(resizable, _rootColumns)',
66
+ ];
67
+ }
68
+
69
+ /** @protected */
70
+ connectedCallback() {
71
+ super.connectedCallback();
72
+ this._addNodeObserver();
73
+ this._updateFlexAndWidth();
74
+ }
75
+
76
+ /** @protected */
77
+ disconnectedCallback() {
78
+ super.disconnectedCallback();
79
+ if (this._observer) {
80
+ this._observer.disconnect();
81
+ }
82
+ }
83
+
84
+ /**
85
+ * @param {string} path
86
+ * @param {unknown=} value
87
+ * @protected
88
+ */
89
+ _columnPropChanged(path, value) {
90
+ if (path === 'hidden') {
91
+ // Prevent synchronization of the hidden state to child columns.
92
+ // If the group is currently auto-hidden, and one column is made visible,
93
+ // we don't want the other columns to become visible as well.
94
+ this._preventHiddenSynchronization = true;
95
+ this._updateVisibleChildColumns(this._childColumns);
96
+ this._preventHiddenSynchronization = false;
97
+ }
98
+
99
+ if (/flexGrow|width|hidden|_childColumns/u.test(path)) {
100
+ this._updateFlexAndWidth();
101
+ }
102
+
103
+ // Don't unfreeze the frozen group because of a non-frozen child
104
+ if (path === 'frozen' && !this.frozen) {
105
+ this.frozen = value;
106
+ }
107
+
108
+ // Don't unfreeze the frozen group because of a non-frozen child
109
+ if (path === 'lastFrozen' && !this._lastFrozen) {
110
+ this._lastFrozen = value;
111
+ }
112
+
113
+ // Don't unfreeze the frozen group because of a non-frozen child
114
+ if (path === 'frozenToEnd' && !this.frozenToEnd) {
115
+ this.frozenToEnd = value;
116
+ }
117
+
118
+ // Don't unfreeze the frozen group because of a non-frozen child
119
+ if (path === 'firstFrozenToEnd' && !this._firstFrozenToEnd) {
120
+ this._firstFrozenToEnd = value;
121
+ }
122
+ }
123
+
124
+ /** @private */
125
+ _groupOrderChanged(order, rootColumns) {
126
+ if (rootColumns) {
127
+ const _rootColumns = rootColumns.slice(0);
128
+
129
+ if (!order) {
130
+ _rootColumns.forEach((column) => {
131
+ column._order = 0;
132
+ });
133
+ return;
134
+ }
135
+ // The parent column order number cascades downwards to it's children
136
+ // so that the resulting order numbering constructs as follows:
137
+ // [ 1000 ]
138
+ // [ 1100 ] | [ 1200 ]
139
+ // [1110] | [1120] | [1210] | [1220]
140
+
141
+ // Trailing zeros are counted so we know the level on which we're working on.
142
+ const trailingZeros = /(0+)$/u.exec(order).pop().length; // NOSONAR
143
+
144
+ // In an unlikely situation where a group has more than 9 child columns,
145
+ // the child scope must have 1 digit less...
146
+ // Log^a_b = Ln(a)/Ln(b)
147
+ // Number of digits of a number is equal to floor(Log(number)_10) + 1
148
+ const childCountDigits = ~~(Math.log(rootColumns.length) / Math.LN10) + 1;
149
+
150
+ // Final scope for the child columns needs to mind both factors.
151
+ const scope = 10 ** (trailingZeros - childCountDigits);
152
+
153
+ if (_rootColumns[0] && _rootColumns[0]._order) {
154
+ _rootColumns.sort((a, b) => a._order - b._order);
155
+ }
156
+ updateColumnOrders(_rootColumns, scope, order);
157
+ }
158
+ }
159
+
160
+ /** @private */
161
+ _groupReorderStatusChanged(reorderStatus, rootColumns) {
162
+ if (reorderStatus === undefined || rootColumns === undefined) {
163
+ return;
164
+ }
165
+
166
+ rootColumns.forEach((column) => {
167
+ column._reorderStatus = reorderStatus;
168
+ });
169
+ }
170
+
171
+ /** @private */
172
+ _groupResizableChanged(resizable, rootColumns) {
173
+ if (resizable === undefined || rootColumns === undefined) {
174
+ return;
175
+ }
176
+
177
+ rootColumns.forEach((column) => {
178
+ column.resizable = resizable;
179
+ });
180
+ }
181
+
182
+ /** @private */
183
+ _updateVisibleChildColumns(childColumns) {
184
+ this._visibleChildColumns = Array.prototype.filter.call(childColumns, (col) => !col.hidden);
185
+ this._colSpan = this._visibleChildColumns.length;
186
+ this._updateAutoHidden();
187
+ }
188
+
189
+ /** @protected */
190
+ _updateFlexAndWidth() {
191
+ if (!this._visibleChildColumns) {
192
+ return;
193
+ }
194
+
195
+ if (this._visibleChildColumns.length > 0) {
196
+ const width = this._visibleChildColumns
197
+ .reduce((prev, curr) => {
198
+ prev += ` + ${(curr.width || '0px').replace('calc', '')}`;
199
+ return prev;
200
+ }, '')
201
+ .substring(3);
202
+ this._setWidth(`calc(${width})`);
203
+ } else {
204
+ this._setWidth('0px');
205
+ }
206
+
207
+ this._setFlexGrow(
208
+ Array.prototype.reduce.call(this._visibleChildColumns, (prev, curr) => prev + curr.flexGrow, 0),
209
+ );
210
+ }
211
+
212
+ /**
213
+ * This method is called before the group's frozen value is being propagated to the child columns.
214
+ * In case some of the child columns are frozen, while others are not, the non-frozen ones
215
+ * will get automatically frozen as well. As this may sometimes be unintended, this method
216
+ * shows a warning in the console in such cases.
217
+ * @private
218
+ */
219
+ __scheduleAutoFreezeWarning(columns, frozenProp) {
220
+ if (this._grid) {
221
+ // Derive the attribute name from the property name
222
+ const frozenAttr = frozenProp.replace(/([A-Z])/gu, '-$1').toLowerCase();
223
+
224
+ // Check if all the columns have the same frozen value
225
+ const firstColumnFrozen = columns[0][frozenProp] || columns[0].hasAttribute(frozenAttr);
226
+ const allSameFrozen = columns.every((column) => {
227
+ return (column[frozenProp] || column.hasAttribute(frozenAttr)) === firstColumnFrozen;
228
+ });
229
+
230
+ if (!allSameFrozen) {
231
+ // Some of the child columns are frozen, some are not. Show a warning.
232
+ this._grid.__autoFreezeWarningDebouncer = Debouncer.debounce(
233
+ this._grid.__autoFreezeWarningDebouncer,
234
+ animationFrame,
235
+ () => {
236
+ console.warn(
237
+ `WARNING: Joining ${frozenProp} and non-${frozenProp} Grid columns inside the same column group! ` +
238
+ `This will automatically freeze all the joined columns to avoid rendering issues. ` +
239
+ `If this was intentional, consider marking each joined column explicitly as ${frozenProp}. ` +
240
+ `Otherwise, exclude the ${frozenProp} columns from the joined group.`,
241
+ );
242
+ },
243
+ );
244
+ }
245
+ }
246
+ }
247
+
248
+ /** @private */
249
+ _groupFrozenChanged(frozen, rootColumns) {
250
+ if (rootColumns === undefined || frozen === undefined) {
251
+ return;
252
+ }
253
+
254
+ // Don't propagate the default `false` value.
255
+ if (frozen !== false) {
256
+ this.__scheduleAutoFreezeWarning(rootColumns, 'frozen');
257
+
258
+ Array.from(rootColumns).forEach((col) => {
259
+ col.frozen = frozen;
260
+ });
261
+ }
262
+ }
263
+
264
+ /** @private */
265
+ _groupFrozenToEndChanged(frozenToEnd, rootColumns) {
266
+ if (rootColumns === undefined || frozenToEnd === undefined) {
267
+ return;
268
+ }
269
+
270
+ // Don't propagate the default `false` value.
271
+ if (frozenToEnd !== false) {
272
+ this.__scheduleAutoFreezeWarning(rootColumns, 'frozenToEnd');
273
+
274
+ Array.from(rootColumns).forEach((col) => {
275
+ col.frozenToEnd = frozenToEnd;
276
+ });
277
+ }
278
+ }
279
+
280
+ /** @private */
281
+ _groupHiddenChanged(hidden) {
282
+ // When initializing the hidden property, only sync hidden state to columns
283
+ // if group is actually hidden. Otherwise, we could override a hidden column
284
+ // to be visible.
285
+ // We always want to run this though if the property is actually changed.
286
+ if (hidden || this.__groupHiddenInitialized) {
287
+ this._synchronizeHidden();
288
+ }
289
+ this.__groupHiddenInitialized = true;
290
+ }
291
+
292
+ /** @private */
293
+ _updateAutoHidden() {
294
+ const wasAutoHidden = this._autoHidden;
295
+ this._autoHidden = (this._visibleChildColumns || []).length === 0;
296
+ // Only modify hidden state if group was auto-hidden, or becomes auto-hidden
297
+ if (wasAutoHidden || this._autoHidden) {
298
+ this.hidden = this._autoHidden;
299
+ }
300
+ }
301
+
302
+ /** @private */
303
+ _synchronizeHidden() {
304
+ if (this._childColumns && !this._preventHiddenSynchronization) {
305
+ this._childColumns.forEach((column) => {
306
+ column.hidden = this.hidden;
307
+ });
308
+ }
309
+ }
310
+
311
+ /** @private */
312
+ _colSpanChanged(colSpan, headerCell, footerCell) {
313
+ if (headerCell) {
314
+ headerCell.setAttribute('colspan', colSpan);
315
+ if (this._grid) {
316
+ this._grid._a11yUpdateCellColspan(headerCell, colSpan);
317
+ }
318
+ }
319
+ if (footerCell) {
320
+ footerCell.setAttribute('colspan', colSpan);
321
+ if (this._grid) {
322
+ this._grid._a11yUpdateCellColspan(footerCell, colSpan);
323
+ }
324
+ }
325
+ }
326
+
327
+ /**
328
+ * @param {!GridColumnGroup} el
329
+ * @return {!Array<!GridColumn>}
330
+ * @protected
331
+ */
332
+ _getChildColumns(el) {
333
+ return ColumnObserver.getColumns(el);
334
+ }
335
+
336
+ /** @private */
337
+ _addNodeObserver() {
338
+ this._observer = new ColumnObserver(this, () => {
339
+ // Prevent synchronization of the hidden state to child columns.
340
+ // If the group is currently auto-hidden, and a visible column is added,
341
+ // we don't want the other columns to become visible as well.
342
+ this._preventHiddenSynchronization = true;
343
+ this._rootColumns = this._getChildColumns(this);
344
+ this._childColumns = this._rootColumns;
345
+ this._updateVisibleChildColumns(this._childColumns);
346
+ this._preventHiddenSynchronization = false;
347
+
348
+ // Update the column tree
349
+ if (this._grid && this._grid._debounceUpdateColumnTree) {
350
+ this._grid._debounceUpdateColumnTree();
351
+ }
352
+ });
353
+ this._observer.flush();
354
+ }
355
+
356
+ /**
357
+ * @param {!Node} node
358
+ * @return {boolean}
359
+ * @protected
360
+ */
361
+ _isColumnElement(node) {
362
+ return node.nodeType === Node.ELEMENT_NODE && /\bcolumn\b/u.test(node.localName);
363
+ }
364
+ };
@@ -4,7 +4,8 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { GridDefaultItem } from './vaadin-grid.js';
7
- import type { ColumnBaseMixinClass } from './vaadin-grid-column.js';
7
+ import type { GridColumnGroupMixin } from './vaadin-grid-column-group-mixin.js';
8
+ export * from './vaadin-grid-column-group-mixin.js';
8
9
 
9
10
  /**
10
11
  * A `<vaadin-grid-column-group>` is used to make groups of columns in `<vaadin-grid>` and
@@ -35,20 +36,9 @@ import type { ColumnBaseMixinClass } from './vaadin-grid-column.js';
35
36
  * column2.renderer = (root, column, model) => { ... };
36
37
  * ```
37
38
  */
38
- declare class GridColumnGroup extends HTMLElement {
39
- /**
40
- * Flex grow ratio for the column group as the sum of the ratios of its child columns.
41
- * @attr {number} flex-grow
42
- */
43
- readonly flexGrow: number | null | undefined;
39
+ declare class GridColumnGroup extends HTMLElement {}
44
40
 
45
- /**
46
- * Width of the column group as the sum of the widths of its child columns.
47
- */
48
- readonly width: string | null | undefined;
49
- }
50
-
51
- interface GridColumnGroup<TItem = GridDefaultItem> extends ColumnBaseMixinClass<TItem> {}
41
+ interface GridColumnGroup<TItem = GridDefaultItem> extends GridColumnGroupMixin<TItem, GridColumnGroup<TItem>> {}
52
42
 
53
43
  declare global {
54
44
  interface HTMLElementTagNameMap {