@vaadin/grid 24.2.0-dev.f254716fe → 24.3.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
- package/src/vaadin-grid-column-group-mixin.d.ts +20 -0
- package/src/vaadin-grid-column-group-mixin.js +369 -0
- package/src/vaadin-grid-column-group.d.ts +4 -14
- package/src/vaadin-grid-column-group.js +8 -356
- package/src/vaadin-grid-column-mixin.d.ts +156 -0
- package/src/vaadin-grid-column-mixin.js +887 -0
- package/src/vaadin-grid-column.d.ts +11 -138
- package/src/vaadin-grid-column.js +6 -876
- package/src/vaadin-grid-data-provider-mixin.d.ts +6 -5
- package/src/vaadin-grid-data-provider-mixin.js +51 -20
- package/src/vaadin-grid-drag-and-drop-mixin.js +1 -1
- package/src/vaadin-grid-dynamic-columns-mixin.js +1 -1
- package/src/vaadin-grid-filter-column.js +5 -1
- package/src/vaadin-grid-filter-element-mixin.d.ts +34 -0
- package/src/vaadin-grid-filter-element-mixin.js +99 -0
- package/src/vaadin-grid-filter.d.ts +4 -21
- package/src/vaadin-grid-filter.js +8 -85
- package/src/vaadin-grid-keyboard-navigation-mixin.js +24 -4
- package/src/vaadin-grid-mixin.d.ts +218 -0
- package/src/vaadin-grid-mixin.js +1022 -0
- package/src/vaadin-grid-scroll-mixin.js +1 -1
- package/src/vaadin-grid-selection-column-base-mixin.d.ts +6 -0
- package/src/vaadin-grid-selection-column-base-mixin.js +151 -0
- package/src/vaadin-grid-selection-column.js +4 -1
- package/src/vaadin-grid-sort-column.js +5 -1
- package/src/vaadin-grid-sorter-mixin.d.ts +44 -0
- package/src/vaadin-grid-sorter-mixin.js +198 -0
- package/src/vaadin-grid-sorter.d.ts +3 -32
- package/src/vaadin-grid-sorter.js +8 -182
- package/src/vaadin-grid-tree-column-mixin.d.ts +19 -0
- package/src/vaadin-grid-tree-column-mixin.js +92 -0
- package/src/vaadin-grid-tree-column.d.ts +9 -7
- package/src/vaadin-grid-tree-column.js +7 -82
- package/src/vaadin-grid-tree-toggle.js +3 -1
- package/src/vaadin-grid.d.ts +5 -190
- package/src/vaadin-grid.js +7 -1018
- package/web-types.json +2311 -0
- package/web-types.lit.json +1007 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.3.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
48
|
"@polymer/polymer": "^3.0.0",
|
|
49
|
-
"@vaadin/a11y-base": "24.
|
|
50
|
-
"@vaadin/checkbox": "24.
|
|
51
|
-
"@vaadin/component-base": "24.
|
|
52
|
-
"@vaadin/lit-renderer": "24.
|
|
53
|
-
"@vaadin/text-field": "24.
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "24.
|
|
55
|
-
"@vaadin/vaadin-material-styles": "24.
|
|
56
|
-
"@vaadin/vaadin-themable-mixin": "24.
|
|
49
|
+
"@vaadin/a11y-base": "24.3.0-alpha2",
|
|
50
|
+
"@vaadin/checkbox": "24.3.0-alpha2",
|
|
51
|
+
"@vaadin/component-base": "24.3.0-alpha2",
|
|
52
|
+
"@vaadin/lit-renderer": "24.3.0-alpha2",
|
|
53
|
+
"@vaadin/text-field": "24.3.0-alpha2",
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha2",
|
|
55
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha2",
|
|
56
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@esm-bundle/chai": "^4.3.4",
|
|
60
|
-
"@vaadin/testing-helpers": "^0.
|
|
60
|
+
"@vaadin/testing-helpers": "^0.5.0",
|
|
61
61
|
"lit": "^2.0.0",
|
|
62
62
|
"sinon": "^13.0.2"
|
|
63
63
|
},
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"web-types.json",
|
|
66
66
|
"web-types.lit.json"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "0fd437292fa2a2f65e29b424d2456909ad2d684b"
|
|
69
69
|
}
|
|
@@ -62,7 +62,7 @@ export const ArrayDataProviderMixin = (superClass) =>
|
|
|
62
62
|
} else if (this._arrayDataProvider.__items === items) {
|
|
63
63
|
// The items array was modified
|
|
64
64
|
this.clearCache();
|
|
65
|
-
this.size = this.
|
|
65
|
+
this.size = this._flatSize;
|
|
66
66
|
} else {
|
|
67
67
|
// The items array was replaced
|
|
68
68
|
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,369 @@
|
|
|
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 { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
|
+
import { animationFrame } from '@vaadin/component-base/src/async.js';
|
|
8
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
9
|
+
import { ColumnBaseMixin } from './vaadin-grid-column-mixin.js';
|
|
10
|
+
import { updateColumnOrders } from './vaadin-grid-helpers.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A mixin providing common vaadin-grid-column-group functionality.
|
|
14
|
+
*
|
|
15
|
+
* @polymerMixin
|
|
16
|
+
* @mixes ColumnBaseMixin
|
|
17
|
+
*/
|
|
18
|
+
export const GridColumnGroupMixin = (superClass) =>
|
|
19
|
+
class extends ColumnBaseMixin(superClass) {
|
|
20
|
+
static get properties() {
|
|
21
|
+
return {
|
|
22
|
+
/** @private */
|
|
23
|
+
_childColumns: {
|
|
24
|
+
value() {
|
|
25
|
+
return this._getChildColumns(this);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Flex grow ratio for the column group as the sum of the ratios of its child columns.
|
|
31
|
+
* @attr {number} flex-grow
|
|
32
|
+
*/
|
|
33
|
+
flexGrow: {
|
|
34
|
+
type: Number,
|
|
35
|
+
readOnly: 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 FlattenedNodesObserver.getFlattenedNodes(el).filter(this._isColumnElement);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** @private */
|
|
337
|
+
_addNodeObserver() {
|
|
338
|
+
this._observer = new FlattenedNodesObserver(this, (info) => {
|
|
339
|
+
if (
|
|
340
|
+
info.addedNodes.filter(this._isColumnElement).length > 0 ||
|
|
341
|
+
info.removedNodes.filter(this._isColumnElement).length > 0
|
|
342
|
+
) {
|
|
343
|
+
// Prevent synchronization of the hidden state to child columns.
|
|
344
|
+
// If the group is currently auto-hidden, and a visible column is added,
|
|
345
|
+
// we don't want the other columns to become visible as well.
|
|
346
|
+
this._preventHiddenSynchronization = true;
|
|
347
|
+
this._rootColumns = this._getChildColumns(this);
|
|
348
|
+
this._childColumns = this._rootColumns;
|
|
349
|
+
this._updateVisibleChildColumns(this._childColumns);
|
|
350
|
+
this._preventHiddenSynchronization = false;
|
|
351
|
+
|
|
352
|
+
// Update the column tree
|
|
353
|
+
if (this._grid && this._grid._debounceUpdateColumnTree) {
|
|
354
|
+
this._grid._debounceUpdateColumnTree();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
this._observer.flush();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @param {!Node} node
|
|
363
|
+
* @return {boolean}
|
|
364
|
+
* @protected
|
|
365
|
+
*/
|
|
366
|
+
_isColumnElement(node) {
|
|
367
|
+
return node.nodeType === Node.ELEMENT_NODE && /\bcolumn\b/u.test(node.localName);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
@@ -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 {
|
|
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 {
|