@vaadin/grid 23.2.0-alpha2 → 23.2.0-dev.48e5e3967
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.2.0-
|
|
3
|
+
"version": "23.2.0-dev.48e5e3967",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
45
45
|
"@polymer/polymer": "^3.0.0",
|
|
46
|
-
"@vaadin/checkbox": "23.2.0-
|
|
47
|
-
"@vaadin/component-base": "23.2.0-
|
|
48
|
-
"@vaadin/lit-renderer": "23.2.0-
|
|
49
|
-
"@vaadin/text-field": "23.2.0-
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "23.2.0-
|
|
51
|
-
"@vaadin/vaadin-material-styles": "23.2.0-
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "23.2.0-
|
|
46
|
+
"@vaadin/checkbox": "23.2.0-dev.48e5e3967",
|
|
47
|
+
"@vaadin/component-base": "23.2.0-dev.48e5e3967",
|
|
48
|
+
"@vaadin/lit-renderer": "23.2.0-dev.48e5e3967",
|
|
49
|
+
"@vaadin/text-field": "23.2.0-dev.48e5e3967",
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-dev.48e5e3967",
|
|
51
|
+
"@vaadin/vaadin-material-styles": "23.2.0-dev.48e5e3967",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-dev.48e5e3967"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@esm-bundle/chai": "^4.3.4",
|
|
56
|
-
"@vaadin/polymer-legacy-adapter": "23.2.0-
|
|
56
|
+
"@vaadin/polymer-legacy-adapter": "23.2.0-dev.48e5e3967",
|
|
57
57
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
58
58
|
"lit": "^2.0.0",
|
|
59
59
|
"sinon": "^13.0.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "961bc4ae5b707c3c02f12b99819b3c12c9b478aa"
|
|
62
62
|
}
|
|
@@ -13,4 +13,20 @@ export declare class SortMixinClass {
|
|
|
13
13
|
* @attr {boolean} multi-sort
|
|
14
14
|
*/
|
|
15
15
|
multiSort: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Controls how columns are added to the sort order when using multi-sort.
|
|
19
|
+
* The sort order is visually indicated by numbers in grid sorters placed in column headers.
|
|
20
|
+
*
|
|
21
|
+
* By default, whenever an unsorted column is sorted, or the sort-direction of a column is
|
|
22
|
+
* changed, that column gets sort priority 1, thus affecting the priority for all the other
|
|
23
|
+
* sorted columns. This is identical to using `multi-sort-priority="prepend"`.
|
|
24
|
+
*
|
|
25
|
+
* Using this property allows to change this behavior so that sorting an unsorted column
|
|
26
|
+
* would add it to the "end" of the sort, and changing column's sort direction would retain
|
|
27
|
+
* it's previous priority. To set this, use `multi-sort-priority="append"`.
|
|
28
|
+
*
|
|
29
|
+
* @attr {string} multi-sort-priority
|
|
30
|
+
*/
|
|
31
|
+
multiSortPriority: 'prepend' | 'append';
|
|
16
32
|
}
|
|
@@ -21,6 +21,25 @@ export const SortMixin = (superClass) =>
|
|
|
21
21
|
value: false,
|
|
22
22
|
},
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Controls how columns are added to the sort order when using multi-sort.
|
|
26
|
+
* The sort order is visually indicated by numbers in grid sorters placed in column headers.
|
|
27
|
+
*
|
|
28
|
+
* By default, whenever an unsorted column is sorted, or the sort-direction of a column is
|
|
29
|
+
* changed, that column gets sort priority 1, thus affecting the priority for all the other
|
|
30
|
+
* sorted columns. This is identical to using `multi-sort-priority="prepend"`.
|
|
31
|
+
*
|
|
32
|
+
* Using this property allows to change this behavior so that sorting an unsorted column
|
|
33
|
+
* would add it to the "end" of the sort, and changing column's sort direction would retain
|
|
34
|
+
* it's previous priority. To set this, use `multi-sort-priority="append"`.
|
|
35
|
+
*
|
|
36
|
+
* @attr {string} multi-sort-priority
|
|
37
|
+
*/
|
|
38
|
+
multiSortPriority: {
|
|
39
|
+
type: String,
|
|
40
|
+
value: 'prepend',
|
|
41
|
+
},
|
|
42
|
+
|
|
24
43
|
/**
|
|
25
44
|
* @type {!Array<!GridSorterDefinition>}
|
|
26
45
|
* @protected
|
|
@@ -48,6 +67,7 @@ export const SortMixin = (superClass) =>
|
|
|
48
67
|
_onSorterChanged(e) {
|
|
49
68
|
const sorter = e.target;
|
|
50
69
|
e.stopPropagation();
|
|
70
|
+
sorter._grid = this;
|
|
51
71
|
this.__updateSorter(sorter);
|
|
52
72
|
this.__applySorters();
|
|
53
73
|
}
|
|
@@ -70,6 +90,26 @@ export const SortMixin = (superClass) =>
|
|
|
70
90
|
this._sorters.forEach((sorter, index) => (sorter._order = this._sorters.length > 1 ? index : null), this);
|
|
71
91
|
}
|
|
72
92
|
|
|
93
|
+
/** @private */
|
|
94
|
+
__appendSorter(sorter) {
|
|
95
|
+
if (!sorter.direction) {
|
|
96
|
+
this._removeArrayItem(this._sorters, sorter);
|
|
97
|
+
} else if (!this._sorters.includes(sorter)) {
|
|
98
|
+
this._sorters.push(sorter);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
this.__updateSortOrders();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** @private */
|
|
105
|
+
__prependSorter(sorter) {
|
|
106
|
+
this._removeArrayItem(this._sorters, sorter);
|
|
107
|
+
if (sorter.direction) {
|
|
108
|
+
this._sorters.unshift(sorter);
|
|
109
|
+
}
|
|
110
|
+
this.__updateSortOrders();
|
|
111
|
+
}
|
|
112
|
+
|
|
73
113
|
/** @private */
|
|
74
114
|
__updateSorter(sorter) {
|
|
75
115
|
if (!sorter.direction && this._sorters.indexOf(sorter) === -1) {
|
|
@@ -79,11 +119,11 @@ export const SortMixin = (superClass) =>
|
|
|
79
119
|
sorter._order = null;
|
|
80
120
|
|
|
81
121
|
if (this.multiSort) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
122
|
+
if (this.multiSortPriority === 'append') {
|
|
123
|
+
this.__appendSorter(sorter);
|
|
124
|
+
} else {
|
|
125
|
+
this.__prependSorter(sorter);
|
|
85
126
|
}
|
|
86
|
-
this.__updateSortOrders();
|
|
87
127
|
} else if (sorter.direction) {
|
|
88
128
|
const otherSorters = this._sorters.filter((s) => s !== sorter);
|
|
89
129
|
this._sorters = [sorter];
|
|
@@ -176,6 +176,10 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
176
176
|
disconnectedCallback() {
|
|
177
177
|
super.disconnectedCallback();
|
|
178
178
|
this._isConnected = false;
|
|
179
|
+
|
|
180
|
+
if (!this.parentNode && this._grid) {
|
|
181
|
+
this._grid.__removeSorters([this]);
|
|
182
|
+
}
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
/** @private */
|