@vaadin/combo-box 22.0.15 → 22.0.16

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": "22.0.15",
3
+ "version": "22.0.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,23 +33,23 @@
33
33
  "dependencies": {
34
34
  "@open-wc/dedupe-mixin": "^1.3.0",
35
35
  "@polymer/polymer": "^3.0.0",
36
- "@vaadin/component-base": "^22.0.15",
37
- "@vaadin/field-base": "^22.0.15",
38
- "@vaadin/input-container": "^22.0.15",
39
- "@vaadin/item": "^22.0.15",
40
- "@vaadin/vaadin-lumo-styles": "^22.0.15",
41
- "@vaadin/vaadin-material-styles": "^22.0.15",
42
- "@vaadin/vaadin-overlay": "^22.0.15",
43
- "@vaadin/vaadin-themable-mixin": "^22.0.15"
36
+ "@vaadin/component-base": "^22.0.16",
37
+ "@vaadin/field-base": "^22.0.16",
38
+ "@vaadin/input-container": "^22.0.16",
39
+ "@vaadin/item": "^22.0.16",
40
+ "@vaadin/vaadin-lumo-styles": "^22.0.16",
41
+ "@vaadin/vaadin-material-styles": "^22.0.16",
42
+ "@vaadin/vaadin-overlay": "^22.0.16",
43
+ "@vaadin/vaadin-themable-mixin": "^22.0.16"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
47
- "@vaadin/dialog": "^22.0.15",
48
- "@vaadin/polymer-legacy-adapter": "^22.0.15",
47
+ "@vaadin/dialog": "^22.0.16",
48
+ "@vaadin/polymer-legacy-adapter": "^22.0.16",
49
49
  "@vaadin/testing-helpers": "^0.3.2",
50
- "@vaadin/text-field": "^22.0.15",
50
+ "@vaadin/text-field": "^22.0.16",
51
51
  "lit": "^2.0.0",
52
52
  "sinon": "^9.2.0"
53
53
  },
54
- "gitHead": "bba021b56ba45da93d2bb980242956ad929ecfe2"
54
+ "gitHead": "dac6f243594ea700bb796d3b41d7b17736d90be8"
55
55
  }
@@ -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
 
@@ -413,12 +413,29 @@ export const ComboBoxMixin = (subclass) =>
413
413
  }
414
414
  }
415
415
 
416
+ /**
417
+ * @param {Event} event
418
+ * @private
419
+ */
420
+ _onToggleButtonClick(event) {
421
+ // Prevent parent components such as `vaadin-grid`
422
+ // from handling the click event after it bubbles.
423
+ event.preventDefault();
424
+
425
+ if (this.opened) {
426
+ this.close();
427
+ } else {
428
+ this.open();
429
+ }
430
+ }
431
+
416
432
  /**
417
433
  * @param {Event} event
418
434
  * @protected
419
435
  */
420
- _onHostClick(_event) {
436
+ _onHostClick(event) {
421
437
  if (!this.autoOpenDisabled) {
438
+ event.preventDefault();
422
439
  this.open();
423
440
  }
424
441
  }
@@ -432,11 +449,7 @@ export const ComboBoxMixin = (subclass) =>
432
449
  if (this._isClearButton(e)) {
433
450
  this._handleClearButtonClick(e);
434
451
  } else if (path.indexOf(this._toggleElement) > -1) {
435
- if (this.opened) {
436
- this.close();
437
- } else {
438
- this.open();
439
- }
452
+ this._onToggleButtonClick(e);
440
453
  } else {
441
454
  this._onHostClick(e);
442
455
  }
@@ -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