@vaadin/grid 24.3.2 → 24.4.0-dev.223e39f050
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 +13 -2
- package/src/vaadin-grid-selection-column-base-mixin.d.ts +0 -2
- package/src/vaadin-grid-selection-column-mixin.js +1 -0
- package/src/vaadin-grid-sort-mixin.js +24 -38
- package/src/vaadin-grid-sorter-mixin.js +8 -18
- package/web-types.json +0 -2516
- package/web-types.lit.json +0 -1063
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.4.0-dev.223e39f050",
|
|
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": "
|
|
50
|
-
"@vaadin/checkbox": "
|
|
51
|
-
"@vaadin/component-base": "
|
|
52
|
-
"@vaadin/lit-renderer": "
|
|
53
|
-
"@vaadin/text-field": "
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
55
|
-
"@vaadin/vaadin-material-styles": "
|
|
56
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
49
|
+
"@vaadin/a11y-base": "24.4.0-dev.223e39f050",
|
|
50
|
+
"@vaadin/checkbox": "24.4.0-dev.223e39f050",
|
|
51
|
+
"@vaadin/component-base": "24.4.0-dev.223e39f050",
|
|
52
|
+
"@vaadin/lit-renderer": "24.4.0-dev.223e39f050",
|
|
53
|
+
"@vaadin/text-field": "24.4.0-dev.223e39f050",
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-dev.223e39f050",
|
|
55
|
+
"@vaadin/vaadin-material-styles": "24.4.0-dev.223e39f050",
|
|
56
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-dev.223e39f050",
|
|
57
|
+
"lit": "^3.0.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@esm-bundle/chai": "^4.3.4",
|
|
60
61
|
"@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": "
|
|
68
|
+
"gitHead": "5e2e3bfc811c95aed9354235fab93fdbf43eb354"
|
|
69
69
|
}
|
|
@@ -25,7 +25,7 @@ export const ArrayDataProviderMixin = (superClass) =>
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
static get observers() {
|
|
28
|
-
return ['__dataProviderOrItemsChanged(dataProvider, items, isAttached,
|
|
28
|
+
return ['__dataProviderOrItemsChanged(dataProvider, items, isAttached, items.*)'];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** @private */
|
|
@@ -37,6 +37,18 @@ export const ArrayDataProviderMixin = (superClass) =>
|
|
|
37
37
|
this.dataProvider = arrayDataProvider;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @override
|
|
42
|
+
* @protected
|
|
43
|
+
*/
|
|
44
|
+
_onDataProviderPageReceived() {
|
|
45
|
+
super._onDataProviderPageReceived();
|
|
46
|
+
|
|
47
|
+
if (this._arrayDataProvider) {
|
|
48
|
+
this.size = this._flatSize;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
/** @private */
|
|
41
53
|
__dataProviderOrItemsChanged(dataProvider, items, isAttached) {
|
|
42
54
|
if (!isAttached) {
|
|
@@ -59,7 +71,6 @@ export const ArrayDataProviderMixin = (superClass) =>
|
|
|
59
71
|
} else if (this._arrayDataProvider.__items === items) {
|
|
60
72
|
// The items array was modified
|
|
61
73
|
this.clearCache();
|
|
62
|
-
this.size = this._flatSize;
|
|
63
74
|
} else {
|
|
64
75
|
// The items array was replaced
|
|
65
76
|
this.__setArrayDataProvider(items);
|
|
@@ -19,8 +19,6 @@ export declare function GridSelectionColumnBaseMixin<TItem, T extends Constructo
|
|
|
19
19
|
* Web component-specific selection state updates must be implemented in the
|
|
20
20
|
* `<vaadin-grid-selection-column>` itself, by overriding the protected methods
|
|
21
21
|
* provided by this mixin.
|
|
22
|
-
*
|
|
23
|
-
* @polymerMixin
|
|
24
22
|
*/
|
|
25
23
|
export declare class GridSelectionColumnBaseMixinClass<TItem> {
|
|
26
24
|
/**
|
|
@@ -7,6 +7,7 @@ import { GridSelectionColumnBaseMixin } from './vaadin-grid-selection-column-bas
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @polymerMixin
|
|
10
|
+
* @mixes GridSelectionColumnBaseMixin
|
|
10
11
|
*/
|
|
11
12
|
export const GridSelectionColumnMixin = (superClass) =>
|
|
12
13
|
class extends GridSelectionColumnBaseMixin(superClass) {
|
|
@@ -104,61 +104,45 @@ export const SortMixin = (superClass) =>
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
this._sorters = this._sorters.filter((sorter) => sortersToRemove.
|
|
108
|
-
if (this.multiSort) {
|
|
109
|
-
this.__updateSortOrders();
|
|
110
|
-
}
|
|
107
|
+
this._sorters = this._sorters.filter((sorter) => !sortersToRemove.includes(sorter));
|
|
111
108
|
this.__applySorters();
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
/** @private */
|
|
115
112
|
__updateSortOrders() {
|
|
116
|
-
this._sorters.forEach((sorter
|
|
117
|
-
sorter._order =
|
|
113
|
+
this._sorters.forEach((sorter) => {
|
|
114
|
+
sorter._order = null;
|
|
118
115
|
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** @private */
|
|
122
|
-
__appendSorter(sorter) {
|
|
123
|
-
if (!sorter.direction) {
|
|
124
|
-
this._removeArrayItem(this._sorters, sorter);
|
|
125
|
-
} else if (!this._sorters.includes(sorter)) {
|
|
126
|
-
this._sorters.push(sorter);
|
|
127
|
-
}
|
|
128
116
|
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this._removeArrayItem(this._sorters, sorter);
|
|
135
|
-
if (sorter.direction) {
|
|
136
|
-
this._sorters.unshift(sorter);
|
|
117
|
+
const activeSorters = this._getActiveSorters();
|
|
118
|
+
if (activeSorters.length > 1) {
|
|
119
|
+
activeSorters.forEach((sorter, index) => {
|
|
120
|
+
sorter._order = index;
|
|
121
|
+
});
|
|
137
122
|
}
|
|
138
|
-
this.__updateSortOrders();
|
|
139
123
|
}
|
|
140
124
|
|
|
141
125
|
/** @private */
|
|
142
126
|
__updateSorter(sorter, shiftClick, fromSorterClick) {
|
|
143
|
-
if (!sorter.direction && this._sorters.
|
|
127
|
+
if (!sorter.direction && !this._sorters.includes(sorter)) {
|
|
144
128
|
return;
|
|
145
129
|
}
|
|
146
130
|
|
|
147
131
|
sorter._order = null;
|
|
148
132
|
|
|
133
|
+
const restSorters = this._sorters.filter((s) => s !== sorter);
|
|
149
134
|
if (
|
|
150
135
|
(this.multiSort && (!this.multiSortOnShiftClick || !fromSorterClick)) ||
|
|
151
136
|
(this.multiSortOnShiftClick && shiftClick)
|
|
152
137
|
) {
|
|
153
138
|
if (this.multiSortPriority === 'append') {
|
|
154
|
-
this.
|
|
139
|
+
this._sorters = [...restSorters, sorter];
|
|
155
140
|
} else {
|
|
156
|
-
this.
|
|
141
|
+
this._sorters = [sorter, ...restSorters];
|
|
157
142
|
}
|
|
158
143
|
} else if (sorter.direction || this.multiSortOnShiftClick) {
|
|
159
|
-
const otherSorters = this._sorters.filter((s) => s !== sorter);
|
|
160
144
|
this._sorters = sorter.direction ? [sorter] : [];
|
|
161
|
-
|
|
145
|
+
restSorters.forEach((sorter) => {
|
|
162
146
|
sorter._order = null;
|
|
163
147
|
sorter.direction = null;
|
|
164
148
|
});
|
|
@@ -167,6 +151,8 @@ export const SortMixin = (superClass) =>
|
|
|
167
151
|
|
|
168
152
|
/** @private */
|
|
169
153
|
__applySorters() {
|
|
154
|
+
this.__updateSortOrders();
|
|
155
|
+
|
|
170
156
|
if (
|
|
171
157
|
this.dataProvider &&
|
|
172
158
|
// No need to clear cache if sorters didn't change and grid is attached
|
|
@@ -181,24 +167,24 @@ export const SortMixin = (superClass) =>
|
|
|
181
167
|
this._previousSorters = this._mapSorters();
|
|
182
168
|
}
|
|
183
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @type {GridSorterDefinition[]}
|
|
172
|
+
* @protected
|
|
173
|
+
*/
|
|
174
|
+
_getActiveSorters() {
|
|
175
|
+
return this._sorters.filter((sorter) => sorter.direction && sorter.isConnected);
|
|
176
|
+
}
|
|
177
|
+
|
|
184
178
|
/**
|
|
185
179
|
* @return {!Array<!GridSorterDefinition>}
|
|
186
180
|
* @protected
|
|
187
181
|
*/
|
|
188
182
|
_mapSorters() {
|
|
189
|
-
return this.
|
|
183
|
+
return this._getActiveSorters().map((sorter) => {
|
|
190
184
|
return {
|
|
191
185
|
path: sorter.path,
|
|
192
186
|
direction: sorter.direction,
|
|
193
187
|
};
|
|
194
188
|
});
|
|
195
189
|
}
|
|
196
|
-
|
|
197
|
-
/** @private */
|
|
198
|
-
_removeArrayItem(array, item) {
|
|
199
|
-
const index = array.indexOf(item);
|
|
200
|
-
if (index > -1) {
|
|
201
|
-
array.splice(index, 1);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
190
|
};
|
|
@@ -101,12 +101,6 @@ export const GridSorterMixin = (superClass) =>
|
|
|
101
101
|
value: null,
|
|
102
102
|
sync: true,
|
|
103
103
|
},
|
|
104
|
-
|
|
105
|
-
/** @private */
|
|
106
|
-
_isConnected: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
observer: '__isConnectedChanged',
|
|
109
|
-
},
|
|
110
104
|
};
|
|
111
105
|
}
|
|
112
106
|
|
|
@@ -123,16 +117,21 @@ export const GridSorterMixin = (superClass) =>
|
|
|
123
117
|
/** @protected */
|
|
124
118
|
connectedCallback() {
|
|
125
119
|
super.connectedCallback();
|
|
126
|
-
this.
|
|
120
|
+
if (this._grid) {
|
|
121
|
+
this._grid.__applySorters();
|
|
122
|
+
} else {
|
|
123
|
+
this.__dispatchSorterChangedEvenIfPossible();
|
|
124
|
+
}
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
/** @protected */
|
|
130
128
|
disconnectedCallback() {
|
|
131
129
|
super.disconnectedCallback();
|
|
132
|
-
this._isConnected = false;
|
|
133
130
|
|
|
134
131
|
if (!this.parentNode && this._grid) {
|
|
135
132
|
this._grid.__removeSorters([this]);
|
|
133
|
+
} else if (this._grid) {
|
|
134
|
+
this._grid.__applySorters();
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
|
|
@@ -141,18 +140,9 @@ export const GridSorterMixin = (superClass) =>
|
|
|
141
140
|
this.__dispatchSorterChangedEvenIfPossible();
|
|
142
141
|
}
|
|
143
142
|
|
|
144
|
-
/** @private */
|
|
145
|
-
__isConnectedChanged(newValue, oldValue) {
|
|
146
|
-
if (oldValue === false) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
this.__dispatchSorterChangedEvenIfPossible();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
143
|
/** @private */
|
|
154
144
|
__dispatchSorterChangedEvenIfPossible() {
|
|
155
|
-
if (this.path === undefined || this.direction === undefined || !this.
|
|
145
|
+
if (this.path === undefined || this.direction === undefined || !this.isConnected) {
|
|
156
146
|
return;
|
|
157
147
|
}
|
|
158
148
|
|