@vaadin/vaadin-grid 22.0.0-alpha6 → 22.0.0-beta1

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 (84) hide show
  1. package/package.json +24 -34
  2. package/src/vaadin-grid-column-group.d.ts +14 -57
  3. package/src/vaadin-grid-column-group.js +4 -311
  4. package/src/vaadin-grid-column.d.ts +14 -142
  5. package/src/vaadin-grid-column.js +4 -759
  6. package/src/vaadin-grid-filter-column.d.ts +14 -30
  7. package/src/vaadin-grid-filter-column.js +4 -111
  8. package/src/vaadin-grid-filter.d.ts +11 -60
  9. package/src/vaadin-grid-filter.js +4 -116
  10. package/src/vaadin-grid-selection-column.d.ts +12 -75
  11. package/src/vaadin-grid-selection-column.js +4 -276
  12. package/src/vaadin-grid-sort-column.d.ts +12 -56
  13. package/src/vaadin-grid-sort-column.js +4 -109
  14. package/src/vaadin-grid-sorter.d.ts +11 -82
  15. package/src/vaadin-grid-sorter.js +4 -221
  16. package/src/vaadin-grid-tree-column.d.ts +14 -31
  17. package/src/vaadin-grid-tree-column.js +4 -110
  18. package/src/vaadin-grid-tree-toggle.d.ts +11 -91
  19. package/src/vaadin-grid-tree-toggle.js +4 -196
  20. package/src/vaadin-grid.d.ts +10 -422
  21. package/src/vaadin-grid.js +4 -1026
  22. package/theme/lumo/vaadin-grid-column-group.js +1 -1
  23. package/theme/lumo/vaadin-grid-column.js +1 -1
  24. package/theme/lumo/vaadin-grid-filter-column.js +1 -2
  25. package/theme/lumo/vaadin-grid-filter.js +1 -2
  26. package/theme/lumo/vaadin-grid-selection-column.js +1 -2
  27. package/theme/lumo/vaadin-grid-sort-column.js +1 -2
  28. package/theme/lumo/vaadin-grid-sorter.js +1 -2
  29. package/theme/lumo/vaadin-grid-tree-column.js +1 -2
  30. package/theme/lumo/vaadin-grid-tree-toggle.js +1 -2
  31. package/theme/lumo/vaadin-grid.js +1 -9
  32. package/theme/material/vaadin-grid-column-group.js +1 -1
  33. package/theme/material/vaadin-grid-column.js +1 -1
  34. package/theme/material/vaadin-grid-filter-column.js +1 -2
  35. package/theme/material/vaadin-grid-filter.js +1 -2
  36. package/theme/material/vaadin-grid-selection-column.js +1 -2
  37. package/theme/material/vaadin-grid-sort-column.js +1 -2
  38. package/theme/material/vaadin-grid-sorter.js +1 -2
  39. package/theme/material/vaadin-grid-tree-column.js +1 -2
  40. package/theme/material/vaadin-grid-tree-toggle.js +1 -2
  41. package/theme/material/vaadin-grid.js +1 -2
  42. package/vaadin-grid.d.ts +0 -1
  43. package/src/array-data-provider.js +0 -145
  44. package/src/interfaces.d.ts +0 -78
  45. package/src/vaadin-grid-a11y-mixin.d.ts +0 -27
  46. package/src/vaadin-grid-a11y-mixin.js +0 -158
  47. package/src/vaadin-grid-active-item-mixin.d.ts +0 -28
  48. package/src/vaadin-grid-active-item-mixin.js +0 -117
  49. package/src/vaadin-grid-array-data-provider-mixin.d.ts +0 -20
  50. package/src/vaadin-grid-array-data-provider-mixin.js +0 -75
  51. package/src/vaadin-grid-column-reordering-mixin.d.ts +0 -47
  52. package/src/vaadin-grid-column-reordering-mixin.js +0 -387
  53. package/src/vaadin-grid-column-resizing-mixin.d.ts +0 -11
  54. package/src/vaadin-grid-column-resizing-mixin.js +0 -111
  55. package/src/vaadin-grid-data-provider-mixin.d.ts +0 -126
  56. package/src/vaadin-grid-data-provider-mixin.js +0 -520
  57. package/src/vaadin-grid-drag-and-drop-mixin.d.ts +0 -73
  58. package/src/vaadin-grid-drag-and-drop-mixin.js +0 -435
  59. package/src/vaadin-grid-dynamic-columns-mixin.d.ts +0 -27
  60. package/src/vaadin-grid-dynamic-columns-mixin.js +0 -180
  61. package/src/vaadin-grid-event-context-mixin.d.ts +0 -33
  62. package/src/vaadin-grid-event-context-mixin.js +0 -57
  63. package/src/vaadin-grid-filter-mixin.d.ts +0 -13
  64. package/src/vaadin-grid-filter-mixin.js +0 -76
  65. package/src/vaadin-grid-helpers.js +0 -23
  66. package/src/vaadin-grid-keyboard-navigation-mixin.d.ts +0 -31
  67. package/src/vaadin-grid-keyboard-navigation-mixin.js +0 -891
  68. package/src/vaadin-grid-row-details-mixin.d.ts +0 -54
  69. package/src/vaadin-grid-row-details-mixin.js +0 -200
  70. package/src/vaadin-grid-scroll-mixin.d.ts +0 -22
  71. package/src/vaadin-grid-scroll-mixin.js +0 -202
  72. package/src/vaadin-grid-selection-mixin.d.ts +0 -39
  73. package/src/vaadin-grid-selection-mixin.js +0 -93
  74. package/src/vaadin-grid-sort-mixin.d.ts +0 -21
  75. package/src/vaadin-grid-sort-mixin.js +0 -139
  76. package/src/vaadin-grid-styles.js +0 -297
  77. package/src/vaadin-grid-styling-mixin.d.ts +0 -37
  78. package/src/vaadin-grid-styling-mixin.js +0 -71
  79. package/theme/lumo/vaadin-grid-sorter-styles.js +0 -54
  80. package/theme/lumo/vaadin-grid-styles.js +0 -380
  81. package/theme/lumo/vaadin-grid-tree-toggle-styles.js +0 -112
  82. package/theme/material/vaadin-grid-sorter-styles.js +0 -72
  83. package/theme/material/vaadin-grid-styles.js +0 -252
  84. package/theme/material/vaadin-grid-tree-toggle-styles.js +0 -42
package/package.json CHANGED
@@ -1,10 +1,30 @@
1
1
  {
2
2
  "name": "@vaadin/vaadin-grid",
3
- "version": "22.0.0-alpha6",
3
+ "version": "22.0.0-beta1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
4
7
  "description": "A free, flexible and high-quality Web Component for showing large amounts of tabular data",
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/vaadin/web-components.git",
12
+ "directory": "packages/vaadin-grid"
13
+ },
14
+ "author": "Vaadin Ltd",
15
+ "homepage": "https://vaadin.com/components",
16
+ "bugs": {
17
+ "url": "https://github.com/vaadin/vaadin-grid/issues"
18
+ },
5
19
  "main": "vaadin-grid.js",
6
20
  "module": "vaadin-grid.js",
7
- "repository": "vaadin/vaadin-grid",
21
+ "files": [
22
+ "all-imports.js",
23
+ "src",
24
+ "theme",
25
+ "vaadin-*.d.ts",
26
+ "vaadin-*.js"
27
+ ],
8
28
  "keywords": [
9
29
  "vaadin",
10
30
  "elements",
@@ -17,38 +37,8 @@
17
37
  "data-grid",
18
38
  "data-table"
19
39
  ],
20
- "author": "Vaadin Ltd",
21
- "license": "Apache-2.0",
22
- "bugs": {
23
- "url": "https://github.com/vaadin/vaadin-grid/issues"
24
- },
25
- "homepage": "https://vaadin.com/components",
26
- "files": [
27
- "vaadin-*.d.ts",
28
- "vaadin-*.js",
29
- "all-imports.js",
30
- "src",
31
- "theme"
32
- ],
33
40
  "dependencies": {
34
- "@polymer/polymer": "^3.0.0",
35
- "@vaadin/checkbox": "^22.0.0-alpha6",
36
- "@vaadin/vaadin-element-mixin": "^22.0.0-alpha6",
37
- "@vaadin/vaadin-lumo-styles": "^22.0.0-alpha6",
38
- "@vaadin/vaadin-material-styles": "^22.0.0-alpha6",
39
- "@vaadin/vaadin-text-field": "^22.0.0-alpha6",
40
- "@vaadin/vaadin-themable-mixin": "^22.0.0-alpha6",
41
- "@vaadin/vaadin-virtual-list": "^22.0.0-alpha6"
42
- },
43
- "devDependencies": {
44
- "@esm-bundle/chai": "^4.3.4",
45
- "@vaadin/testing-helpers": "^0.3.0",
46
- "@vaadin/vaadin-template-renderer": "^22.0.0-alpha6",
47
- "lit": "^2.0.0-rc.1",
48
- "sinon": "^9.2.0"
49
- },
50
- "publishConfig": {
51
- "access": "public"
41
+ "@vaadin/grid": "22.0.0-beta1"
52
42
  },
53
- "gitHead": "4b136b1c7da8942960e7255f40c27859125b3a45"
43
+ "gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e"
54
44
  }
@@ -1,62 +1,19 @@
1
- import { GridDefaultItem } from './interfaces';
2
- import { ColumnBaseMixin, GridColumnElement } from './vaadin-grid-column.js';
3
-
4
1
  /**
5
- * A `<vaadin-grid-column-group>` is used to make groups of columns in `<vaadin-grid>` and
6
- * to configure additional headers and footers.
7
- *
8
- * Groups can be nested to create complex header and footer configurations.
9
- *
10
- * #### Example:
11
- * ```html
12
- * <vaadin-grid-column-group resizable id="columnGroup">
13
- * <vaadin-grid-column id="column1"></vaadin-grid-column>
14
- * <vaadin-grid-column id="column2"></vaadin-grid-column>
15
- * </vaadin-grid-column-group>
16
- * ```
17
- *
18
- * ```js
19
- * const columnGroup = document.querySelector('#columnGroup');
20
- * columnGroup.headerRenderer = (root, columnGroup) => {
21
- * root.textContent = 'header';
22
- * }
23
- *
24
- * const column1 = document.querySelector('#column1');
25
- * column1.headerRenderer = (root, column) => { ... };
26
- * column1.renderer = (root, column, model) => { ... };
27
- *
28
- * const column2 = document.querySelector('#column2');
29
- * column2.headerRenderer = (root, column) => { ... };
30
- * column2.renderer = (root, column, model) => { ... };
31
- * ```
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
32
5
  */
33
- declare class GridColumnGroupElement<TItem = GridDefaultItem> extends HTMLElement {
34
- /**
35
- * Flex grow ratio for the column group as the sum of the ratios of its child columns.
36
- * @attr {number} flex-grow
37
- */
38
- readonly flexGrow: number | null | undefined;
39
-
40
- /**
41
- * Width of the column group as the sum of the widths of its child columns.
42
- */
43
- readonly width: string | null | undefined;
44
-
45
- _columnPropChanged(path: string, value?: unknown | null): void;
46
-
47
- _updateFlexAndWidth(): void;
48
-
49
- _getChildColumns(el: GridColumnGroupElement<TItem>): GridColumnElement<TItem>[];
6
+ import { GridDefaultItem } from '@vaadin/grid/src/vaadin-grid.js';
7
+ import { GridColumnGroup } from '@vaadin/grid/src/vaadin-grid-column-group.js';
50
8
 
51
- _isColumnElement(node: Node): boolean;
52
- }
53
-
54
- interface GridColumnGroupElement<TItem = GridDefaultItem> extends ColumnBaseMixin<TItem> {}
9
+ /**
10
+ * @deprecated Import `GridColumnGroup` from `@vaadin/grid/vaadin-grid-column-group` instead.
11
+ */
12
+ export type GridColumnGroupElement<TItem = GridDefaultItem> = GridColumnGroup<TItem>;
55
13
 
56
- declare global {
57
- interface HTMLElementTagNameMap {
58
- 'vaadin-grid-column-group': GridColumnGroupElement<GridDefaultItem>;
59
- }
60
- }
14
+ /**
15
+ * @deprecated Import `GridColumnGroup` from `@vaadin/grid/vaadin-grid-column-group` instead.
16
+ */
17
+ export const GridColumnGroupElement: typeof GridColumnGroup;
61
18
 
62
- export { GridColumnGroupElement };
19
+ export * from '@vaadin/grid/src/vaadin-grid-column-group.js';
@@ -3,318 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement } from '@polymer/polymer/polymer-element.js';
7
- import { microTask } from '@polymer/polymer/lib/utils/async.js';
8
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
9
- import { ColumnBaseMixin } from './vaadin-grid-column.js';
10
- import { updateColumnOrders } from './vaadin-grid-helpers.js';
6
+ import { GridColumnGroup } from '@vaadin/grid/src/vaadin-grid-column-group.js';
11
7
 
12
8
  /**
13
- * A `<vaadin-grid-column-group>` is used to make groups of columns in `<vaadin-grid>` and
14
- * to configure additional headers and footers.
15
- *
16
- * Groups can be nested to create complex header and footer configurations.
17
- *
18
- * #### Example:
19
- * ```html
20
- * <vaadin-grid-column-group resizable id="columnGroup">
21
- * <vaadin-grid-column id="column1"></vaadin-grid-column>
22
- * <vaadin-grid-column id="column2"></vaadin-grid-column>
23
- * </vaadin-grid-column-group>
24
- * ```
25
- *
26
- * ```js
27
- * const columnGroup = document.querySelector('#columnGroup');
28
- * columnGroup.headerRenderer = (root, columnGroup) => {
29
- * root.textContent = 'header';
30
- * }
31
- *
32
- * const column1 = document.querySelector('#column1');
33
- * column1.headerRenderer = (root, column) => { ... };
34
- * column1.renderer = (root, column, model) => { ... };
35
- *
36
- * const column2 = document.querySelector('#column2');
37
- * column2.headerRenderer = (root, column) => { ... };
38
- * column2.renderer = (root, column, model) => { ... };
39
- * ```
40
- *
41
- * @extends HTMLElement
42
- * @mixes ColumnBaseMixin
9
+ * @deprecated Import `GridColumnGroup` from `@vaadin/grid/vaadin-grid-column-group` instead.
43
10
  */
44
- class GridColumnGroupElement extends ColumnBaseMixin(PolymerElement) {
45
- static get is() {
46
- return 'vaadin-grid-column-group';
47
- }
11
+ export const GridColumnGroupElement = GridColumnGroup;
48
12
 
49
- static get properties() {
50
- return {
51
- /** @private */
52
- _childColumns: {
53
- value: function () {
54
- return this._getChildColumns(this);
55
- }
56
- },
57
-
58
- /**
59
- * Flex grow ratio for the column group as the sum of the ratios of its child columns.
60
- * @attr {number} flex-grow
61
- */
62
- flexGrow: {
63
- type: Number,
64
- readOnly: true
65
- },
66
-
67
- /**
68
- * Width of the column group as the sum of the widths of its child columns.
69
- */
70
- width: {
71
- type: String,
72
- readOnly: true
73
- },
74
-
75
- /** @private */
76
- _visibleChildColumns: Array,
77
-
78
- /** @private */
79
- _colSpan: Number,
80
-
81
- /** @private */
82
- _rootColumns: Array
83
- };
84
- }
85
-
86
- static get observers() {
87
- return [
88
- '_updateVisibleChildColumns(_childColumns)',
89
- '_childColumnsChanged(_childColumns)',
90
- '_groupFrozenChanged(frozen, _rootColumns)',
91
- '_groupHiddenChanged(hidden, _rootColumns)',
92
- '_visibleChildColumnsChanged(_visibleChildColumns)',
93
- '_colSpanChanged(_colSpan, _headerCell, _footerCell)',
94
- '_groupOrderChanged(_order, _rootColumns)',
95
- '_groupReorderStatusChanged(_reorderStatus, _rootColumns)',
96
- '_groupResizableChanged(resizable, _rootColumns)'
97
- ];
98
- }
99
-
100
- /** @protected */
101
- connectedCallback() {
102
- super.connectedCallback();
103
- this._addNodeObserver();
104
- this._updateFlexAndWidth();
105
- }
106
-
107
- /** @protected */
108
- disconnectedCallback() {
109
- super.disconnectedCallback();
110
- this._observer && this._observer.disconnect();
111
- }
112
-
113
- /**
114
- * @param {string} path
115
- * @param {unknown=} value
116
- * @protected
117
- */
118
- _columnPropChanged(path, value) {
119
- if (path === 'hidden') {
120
- this._preventHiddenCascade = true;
121
- this._updateVisibleChildColumns(this._childColumns);
122
- this._preventHiddenCascade = false;
123
- }
124
-
125
- if (/flexGrow|width|hidden|_childColumns/.test(path)) {
126
- this._updateFlexAndWidth();
127
- }
128
-
129
- if (path === 'frozen') {
130
- // Don’t unfreeze the frozen group because of a non-frozen child
131
- this.frozen = this.frozen || value;
132
- }
133
-
134
- if (path === 'lastFrozen') {
135
- // Don’t unfreeze the frozen group because of a non-frozen child
136
- this._lastFrozen = this._lastFrozen || value;
137
- }
138
- }
139
-
140
- /** @private */
141
- _groupOrderChanged(order, rootColumns) {
142
- if (rootColumns) {
143
- const _rootColumns = rootColumns.slice(0);
144
-
145
- if (!order) {
146
- _rootColumns.forEach((column) => (column._order = 0));
147
- return;
148
- }
149
- // The parent column order number cascades downwards to it's children
150
- // so that the resulting order numbering constructs as follows:
151
- // [ 1000 ]
152
- // [ 1100 ] | [ 1200 ]
153
- // [1110] | [1120] | [1210] | [1220]
154
-
155
- // Trailing zeros are counted so we know the level on which we're working on.
156
- const trailingZeros = /(0+)$/.exec(order).pop().length;
157
-
158
- // In an unlikely situation where a group has more than 9 child columns,
159
- // the child scope must have 1 digit less...
160
- // Log^a_b = Ln(a)/Ln(b)
161
- // Number of digits of a number is equal to floor(Log(number)_10) + 1
162
- const childCountDigits = ~~(Math.log(rootColumns.length) / Math.LN10) + 1;
163
-
164
- // Final scope for the child columns needs to mind both factors.
165
- const scope = Math.pow(10, trailingZeros - childCountDigits);
166
-
167
- if (_rootColumns[0] && _rootColumns[0]._order) {
168
- _rootColumns.sort((a, b) => a._order - b._order);
169
- }
170
- updateColumnOrders(_rootColumns, scope, order);
171
- }
172
- }
173
-
174
- /** @private */
175
- _groupReorderStatusChanged(reorderStatus, rootColumns) {
176
- if (reorderStatus === undefined || rootColumns === undefined) {
177
- return;
178
- }
179
-
180
- rootColumns.forEach((column) => (column._reorderStatus = reorderStatus));
181
- }
182
-
183
- /** @private */
184
- _groupResizableChanged(resizable, rootColumns) {
185
- if (resizable === undefined || rootColumns === undefined) {
186
- return;
187
- }
188
-
189
- rootColumns.forEach((column) => (column.resizable = resizable));
190
- }
191
-
192
- /** @private */
193
- _updateVisibleChildColumns(childColumns) {
194
- this._visibleChildColumns = Array.prototype.filter.call(childColumns, (col) => !col.hidden);
195
- }
196
-
197
- /** @private */
198
- _childColumnsChanged(childColumns) {
199
- if (!this._autoHidden && this.hidden) {
200
- Array.prototype.forEach.call(childColumns, (column) => (column.hidden = true));
201
- this._updateVisibleChildColumns(childColumns);
202
- }
203
- }
204
-
205
- /** @protected */
206
- _updateFlexAndWidth() {
207
- if (!this._visibleChildColumns) {
208
- return;
209
- }
210
-
211
- if (this._visibleChildColumns.length) {
212
- this._setWidth(
213
- 'calc(' +
214
- Array.prototype.reduce
215
- .call(
216
- this._visibleChildColumns,
217
- (prev, curr) => (prev += ' + ' + (curr.width || '0px').replace('calc', '')),
218
- ''
219
- )
220
- .substring(3) +
221
- ')'
222
- );
223
- } else {
224
- this._setWidth('0px');
225
- }
226
-
227
- this._setFlexGrow(Array.prototype.reduce.call(this._visibleChildColumns, (prev, curr) => prev + curr.flexGrow, 0));
228
- }
229
-
230
- /** @private */
231
- _groupFrozenChanged(frozen, rootColumns) {
232
- if (rootColumns === undefined || frozen === undefined) {
233
- return;
234
- }
235
-
236
- // Don’t propagate the default `false` value.
237
- if (frozen !== false) {
238
- Array.from(rootColumns).forEach((col) => (col.frozen = frozen));
239
- }
240
- }
241
-
242
- /** @private */
243
- _groupHiddenChanged(hidden, rootColumns) {
244
- if (rootColumns && !this._preventHiddenCascade) {
245
- this._ignoreVisibleChildColumns = true;
246
- rootColumns.forEach((column) => (column.hidden = hidden));
247
- this._ignoreVisibleChildColumns = false;
248
- }
249
-
250
- this._columnPropChanged('hidden');
251
- }
252
-
253
- /** @private */
254
- _visibleChildColumnsChanged(visibleChildColumns) {
255
- this._colSpan = visibleChildColumns.length;
256
-
257
- if (!this._ignoreVisibleChildColumns) {
258
- if (visibleChildColumns.length === 0) {
259
- this._autoHidden = this.hidden = true;
260
- } else if (this.hidden && this._autoHidden) {
261
- this._autoHidden = this.hidden = false;
262
- }
263
- }
264
- }
265
-
266
- /** @private */
267
- _colSpanChanged(colSpan, headerCell, footerCell) {
268
- if (headerCell) {
269
- headerCell.setAttribute('colspan', colSpan);
270
- this._grid && this._grid._a11yUpdateCellColspan(headerCell, colSpan);
271
- }
272
- if (footerCell) {
273
- footerCell.setAttribute('colspan', colSpan);
274
- this._grid && this._grid._a11yUpdateCellColspan(footerCell, colSpan);
275
- }
276
- }
277
-
278
- /**
279
- * @param {!GridColumnGroupElement} el
280
- * @return {!Array<!GridColumnElement>}
281
- * @protected
282
- */
283
- _getChildColumns(el) {
284
- return FlattenedNodesObserver.getFlattenedNodes(el).filter(this._isColumnElement);
285
- }
286
-
287
- /** @private */
288
- _addNodeObserver() {
289
- this._observer = new FlattenedNodesObserver(this, (info) => {
290
- if (
291
- info.addedNodes.filter(this._isColumnElement).length > 0 ||
292
- info.removedNodes.filter(this._isColumnElement).length > 0
293
- ) {
294
- this._preventHiddenCascade = true;
295
- this._rootColumns = this._getChildColumns(this);
296
- this._childColumns = this._rootColumns;
297
- this._preventHiddenCascade = false;
298
-
299
- // Update the column tree with microtask timing to avoid shady style scope issues
300
- microTask.run(() => {
301
- this._grid && this._grid._updateColumnTree && this._grid._updateColumnTree();
302
- });
303
- }
304
- });
305
- this._observer.flush();
306
- }
307
-
308
- /**
309
- * @param {!Node} node
310
- * @return {boolean}
311
- * @protected
312
- */
313
- _isColumnElement(node) {
314
- return node.nodeType === Node.ELEMENT_NODE && /\bcolumn\b/.test(node.localName);
315
- }
316
- }
317
-
318
- customElements.define(GridColumnGroupElement.is, GridColumnGroupElement);
319
-
320
- export { GridColumnGroupElement };
13
+ export * from '@vaadin/grid/src/vaadin-grid-column-group.js';
@@ -1,147 +1,19 @@
1
- import { GridElement } from './vaadin-grid.js';
2
-
3
- import { GridBodyRenderer, GridColumnTextAlign, GridHeaderFooterRenderer, GridDefaultItem } from './interfaces';
4
-
5
- declare function ColumnBaseMixin<TItem, T extends new (...args: any[]) => {}>(
6
- base: T
7
- ): T & ColumnBaseMixinConstructor<TItem>;
8
-
9
- export interface ColumnBaseMixinConstructor<TItem> {
10
- new (...args: any[]): ColumnBaseMixin<TItem>;
11
- }
12
-
13
- interface ColumnBaseMixin<TItem> {
14
- readonly _grid: GridElement<TItem> | undefined;
15
- readonly _allCells: HTMLElement[];
16
-
17
- /**
18
- * When set to true, the column is user-resizable.
19
- */
20
- resizable: boolean | null | undefined;
21
-
22
- /**
23
- * When true, the column is frozen. When a column inside of a column group is frozen,
24
- * all of the sibling columns inside the group will get frozen also.
25
- */
26
- frozen: boolean;
27
-
28
- /**
29
- * When set to true, the cells for this column are hidden.
30
- */
31
- hidden: boolean;
32
-
33
- /**
34
- * Text content to display in the header cell of the column.
35
- */
36
- header: string | null | undefined;
37
-
38
- /**
39
- * Aligns the columns cell content horizontally.
40
- * Supported values: "start", "center" and "end".
41
- * @attr {start|center|end} text-align
42
- */
43
- textAlign: GridColumnTextAlign | null | undefined;
44
-
45
- _lastFrozen: boolean;
46
-
47
- _order: number | null | undefined;
48
-
49
- _emptyCells: HTMLElement[] | null;
50
-
51
- /**
52
- * Custom function for rendering the header content.
53
- * Receives two arguments:
54
- *
55
- * - `root` The header cell content DOM element. Append your content to it.
56
- * - `column` The `<vaadin-grid-column>` element.
57
- */
58
- headerRenderer: GridHeaderFooterRenderer<TItem> | null | undefined;
59
-
60
- /**
61
- * Custom function for rendering the footer content.
62
- * Receives two arguments:
63
- *
64
- * - `root` The footer cell content DOM element. Append your content to it.
65
- * - `column` The `<vaadin-grid-column>` element.
66
- */
67
- footerRenderer: GridHeaderFooterRenderer<TItem> | null | undefined;
68
-
69
- _findHostGrid(): GridElement<TItem> | undefined;
70
-
71
- _generateHeader(path: string): string;
72
-
73
- _toggleAttribute(name: string, bool: boolean, node: Element): void;
74
- }
75
-
76
1
  /**
77
- * A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`
78
- * should look like.
79
- *
80
- * See [`<vaadin-grid>`](#/elements/vaadin-grid) documentation for instructions on how
81
- * to configure the `<vaadin-grid-column>`.
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
82
5
  */
83
- declare class GridColumnElement<TItem = GridDefaultItem> extends HTMLElement {
84
- /**
85
- * Width of the cells for this column.
86
- */
87
- width: string | null | undefined;
88
-
89
- /**
90
- * Flex grow ratio for the cell widths. When set to 0, cell width is fixed.
91
- * @attr {number} flex-grow
92
- */
93
- flexGrow: number;
94
-
95
- /**
96
- * Custom function for rendering the cell content.
97
- * Receives three arguments:
98
- *
99
- * - `root` The cell content DOM element. Append your content to it.
100
- * - `column` The `<vaadin-grid-column>` element.
101
- * - `model` The object with the properties related with
102
- * the rendered item, contains:
103
- * - `model.index` The index of the item.
104
- * - `model.item` The item.
105
- * - `model.expanded` Sublevel toggle state.
106
- * - `model.level` Level of the tree represented with a horizontal offset of the toggle button.
107
- * - `model.selected` Selected state.
108
- * - `model.detailsOpened` Details opened state.
109
- */
110
- renderer: GridBodyRenderer<TItem> | null | undefined;
111
-
112
- /**
113
- * Path to an item sub-property whose value gets displayed in the column body cells.
114
- * The property name is also shown in the column header if an explicit header or renderer isn't defined.
115
- */
116
- path: string | null | undefined;
6
+ import { GridDefaultItem } from '@vaadin/grid/src/vaadin-grid.js';
7
+ import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js';
117
8
 
118
- /**
119
- * Automatically sets the width of the column based on the column contents when this is set to `true`.
120
- *
121
- * For performance reasons the column width is calculated automatically only once when the grid items
122
- * are rendered for the first time and the calculation only considers the rows which are currently
123
- * rendered in DOM (a bit more than what is currently visible). If the grid is scrolled, or the cell
124
- * content changes, the column width might not match the contents anymore.
125
- *
126
- * Hidden columns are ignored in the calculation and their widths are not automatically updated when
127
- * you show a column that was initially hidden.
128
- *
129
- * You can manually trigger the auto sizing behavior again by calling `grid.recalculateColumnWidths()`.
130
- *
131
- * The column width may still grow larger when `flexGrow` is not 0.
132
- * @attr {boolean} auto-width
133
- */
134
- autoWidth: boolean;
135
-
136
- _cells: HTMLElement[] | null;
137
- }
138
-
139
- interface GridColumnElement<TItem = GridDefaultItem> extends ColumnBaseMixin<TItem> {}
9
+ /**
10
+ * @deprecated Import `GridColumn` from `@vaadin/grid/vaadin-grid-column` instead.
11
+ */
12
+ export type GridColumnElement<TItem = GridDefaultItem> = GridColumn<TItem>;
140
13
 
141
- declare global {
142
- interface HTMLElementTagNameMap {
143
- 'vaadin-grid-column': GridColumnElement<GridDefaultItem>;
144
- }
145
- }
14
+ /**
15
+ * @deprecated Import `GridColumn` from `@vaadin/grid/vaadin-grid-column` instead.
16
+ */
17
+ export const GridColumnElement: typeof GridColumn;
146
18
 
147
- export { ColumnBaseMixin, GridColumnElement };
19
+ export * from '@vaadin/grid/src/vaadin-grid-column.js';