@vaadin/combo-box 23.0.10 → 23.0.11

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/combo-box",
3
- "version": "23.0.10",
3
+ "version": "23.0.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,23 +34,23 @@
34
34
  "dependencies": {
35
35
  "@open-wc/dedupe-mixin": "^1.3.0",
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "^23.0.10",
38
- "@vaadin/field-base": "^23.0.10",
39
- "@vaadin/input-container": "^23.0.10",
40
- "@vaadin/item": "^23.0.10",
41
- "@vaadin/vaadin-lumo-styles": "^23.0.10",
42
- "@vaadin/vaadin-material-styles": "^23.0.10",
43
- "@vaadin/vaadin-overlay": "^23.0.10",
44
- "@vaadin/vaadin-themable-mixin": "^23.0.10"
37
+ "@vaadin/component-base": "^23.0.11",
38
+ "@vaadin/field-base": "^23.0.11",
39
+ "@vaadin/input-container": "^23.0.11",
40
+ "@vaadin/item": "^23.0.11",
41
+ "@vaadin/vaadin-lumo-styles": "^23.0.11",
42
+ "@vaadin/vaadin-material-styles": "^23.0.11",
43
+ "@vaadin/vaadin-overlay": "^23.0.11",
44
+ "@vaadin/vaadin-themable-mixin": "^23.0.11"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@esm-bundle/chai": "^4.3.4",
48
- "@vaadin/dialog": "^23.0.10",
49
- "@vaadin/polymer-legacy-adapter": "^23.0.10",
48
+ "@vaadin/dialog": "^23.0.11",
49
+ "@vaadin/polymer-legacy-adapter": "^23.0.11",
50
50
  "@vaadin/testing-helpers": "^0.3.2",
51
- "@vaadin/text-field": "^23.0.10",
51
+ "@vaadin/text-field": "^23.0.11",
52
52
  "lit": "^2.0.0",
53
53
  "sinon": "^9.2.0"
54
54
  },
55
- "gitHead": "e8402a55ce0e823ae6da5c97486998cfd931b1d3"
55
+ "gitHead": "10838304fe6f5c98b838ec3a90bdcf49cbf4650b"
56
56
  }
@@ -74,18 +74,6 @@ export const ComboBoxDataProviderMixin = (superClass) =>
74
74
  ];
75
75
  }
76
76
 
77
- /** @private */
78
- _dataProviderClearFilter(dataProvider, opened, value) {
79
- // Can't depend on filter in this observer as we don't want
80
- // to clear the filter whenever it's set
81
- if (dataProvider && !this.loading && this.filter && !(opened && this.autoOpenDisabled && value === this.filter)) {
82
- this.size = undefined;
83
- this._pendingRequests = {};
84
- this.filter = '';
85
- this.clearCache();
86
- }
87
- }
88
-
89
77
  /** @protected */
90
78
  ready() {
91
79
  super.ready();
@@ -118,8 +106,32 @@ export const ComboBoxDataProviderMixin = (superClass) =>
118
106
  return;
119
107
  }
120
108
 
109
+ this._refreshData();
110
+ }
111
+
112
+ /** @private */
113
+ _dataProviderClearFilter(dataProvider, opened, value) {
114
+ // Can't depend on filter in this observer as we don't want
115
+ // to clear the filter whenever it's set
116
+ if (dataProvider && !this.loading && this.filter && !(opened && this.autoOpenDisabled && value === this.filter)) {
117
+ this._refreshData(true);
118
+ }
119
+ }
120
+
121
+ /** @private */
122
+ _refreshData(clearFilter) {
123
+ // Immediately mark as loading if this refresh leads to re-fetching pages
124
+ // This prevents some issues with the properties below triggering
125
+ // observers that also rely on the loading state
126
+ this.loading = this._shouldFetchData();
127
+ // Reset size and internal loading state
121
128
  this.size = undefined;
122
129
  this._pendingRequests = {};
130
+ // Clear filter if requested
131
+ if (clearFilter) {
132
+ this.filter = '';
133
+ }
134
+ // Clear cached pages, and reload current page if we need the data
123
135
  this.clearCache();
124
136
  }
125
137
 
@@ -423,12 +423,29 @@ export const ComboBoxMixin = (subclass) =>
423
423
  }
424
424
  }
425
425
 
426
+ /**
427
+ * @param {Event} event
428
+ * @private
429
+ */
430
+ _onToggleButtonClick(event) {
431
+ // Prevent parent components such as `vaadin-grid`
432
+ // from handling the click event after it bubbles.
433
+ event.preventDefault();
434
+
435
+ if (this.opened) {
436
+ this.close();
437
+ } else {
438
+ this.open();
439
+ }
440
+ }
441
+
426
442
  /**
427
443
  * @param {Event} event
428
444
  * @protected
429
445
  */
430
- _onHostClick(_event) {
446
+ _onHostClick(event) {
431
447
  if (!this.autoOpenDisabled) {
448
+ event.preventDefault();
432
449
  this.open();
433
450
  }
434
451
  }
@@ -442,11 +459,7 @@ export const ComboBoxMixin = (subclass) =>
442
459
  if (this._isClearButton(e)) {
443
460
  this._handleClearButtonClick(e);
444
461
  } else if (path.indexOf(this._toggleElement) > -1) {
445
- if (this.opened) {
446
- this.close();
447
- } else {
448
- this.open();
449
- }
462
+ this._onToggleButtonClick(e);
450
463
  } else {
451
464
  this._onHostClick(e);
452
465
  }
@@ -1,4 +1,5 @@
1
1
  import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
2
3
  import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
3
4
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
5