@vaadin/combo-box 23.1.0-beta4 → 23.1.0-rc1

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.1.0-beta4",
3
+ "version": "23.1.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,24 +36,23 @@
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "23.1.0-beta4",
40
- "@vaadin/field-base": "23.1.0-beta4",
41
- "@vaadin/input-container": "23.1.0-beta4",
42
- "@vaadin/item": "23.1.0-beta4",
43
- "@vaadin/lit-renderer": "23.1.0-beta4",
44
- "@vaadin/vaadin-lumo-styles": "23.1.0-beta4",
45
- "@vaadin/vaadin-material-styles": "23.1.0-beta4",
46
- "@vaadin/vaadin-overlay": "23.1.0-beta4",
47
- "@vaadin/vaadin-themable-mixin": "23.1.0-beta4"
39
+ "@vaadin/component-base": "23.1.0-rc1",
40
+ "@vaadin/field-base": "23.1.0-rc1",
41
+ "@vaadin/input-container": "23.1.0-rc1",
42
+ "@vaadin/item": "23.1.0-rc1",
43
+ "@vaadin/lit-renderer": "23.1.0-rc1",
44
+ "@vaadin/vaadin-lumo-styles": "23.1.0-rc1",
45
+ "@vaadin/vaadin-material-styles": "23.1.0-rc1",
46
+ "@vaadin/vaadin-overlay": "23.1.0-rc1",
47
+ "@vaadin/vaadin-themable-mixin": "23.1.0-rc1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
51
- "@vaadin/dialog": "23.1.0-beta4",
52
- "@vaadin/polymer-legacy-adapter": "23.1.0-beta4",
51
+ "@vaadin/polymer-legacy-adapter": "23.1.0-rc1",
53
52
  "@vaadin/testing-helpers": "^0.3.2",
54
- "@vaadin/text-field": "23.1.0-beta4",
53
+ "@vaadin/text-field": "23.1.0-rc1",
55
54
  "lit": "^2.0.0",
56
55
  "sinon": "^13.0.2"
57
56
  },
58
- "gitHead": "06e283473964ecb3085aacf3eddb5333d052a045"
57
+ "gitHead": "5ecb85e16e938df827fefca4bd2a665a1e29913e"
59
58
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
- export type ComboBoxDataProviderCallback<TItem> = (items: Array<TItem>, size: number) => void;
8
+ export type ComboBoxDataProviderCallback<TItem> = (items: TItem[], size: number) => void;
9
9
 
10
10
  export interface ComboBoxDataProviderParams {
11
11
  page: number;
@@ -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
 
@@ -31,14 +31,6 @@ export declare function ComboBoxMixin<TItem, T extends Constructor<HTMLElement>>
31
31
  Constructor<KeyboardMixinClass>;
32
32
 
33
33
  export declare class ComboBoxMixinClass<TItem> {
34
- protected readonly _propertyForValue: string;
35
-
36
- protected _inputElementValue: string | undefined;
37
-
38
- protected _revertInputValue(): void;
39
-
40
- protected _getItemElements(): HTMLElement[];
41
-
42
34
  /**
43
35
  * True if the dropdown is open, false otherwise.
44
36
  */
@@ -72,7 +64,7 @@ export declare class ComboBoxMixinClass<TItem> {
72
64
  * A full set of items to filter the visible options from.
73
65
  * The items can be of either `String` or `Object` type.
74
66
  */
75
- items: Array<TItem> | undefined;
67
+ items: TItem[] | undefined;
76
68
 
77
69
  /**
78
70
  * If `true`, the user can input a value that is not present in the items list.
@@ -88,7 +80,7 @@ export declare class ComboBoxMixinClass<TItem> {
88
80
  * can be assigned directly to omit the internal filtering functionality.
89
81
  * The items can be of either `String` or `Object` type.
90
82
  */
91
- filteredItems: Array<TItem> | undefined;
83
+ filteredItems: TItem[] | undefined;
92
84
 
93
85
  /**
94
86
  * The `String` value for the selected item of the combo box.
@@ -151,6 +143,10 @@ export declare class ComboBoxMixinClass<TItem> {
151
143
  */
152
144
  invalid: boolean;
153
145
 
146
+ protected readonly _propertyForValue: string;
147
+
148
+ protected _inputElementValue: string | undefined;
149
+
154
150
  /**
155
151
  * Requests an update for the content of items.
156
152
  * While performing the update, it invokes the renderer (passed in the `renderer` property) once an item.
@@ -179,4 +175,8 @@ export declare class ComboBoxMixinClass<TItem> {
179
175
  * You can override this method for custom validations.
180
176
  */
181
177
  checkValidity(): boolean;
178
+
179
+ protected _revertInputValue(): void;
180
+
181
+ protected _getItemElements(): HTMLElement[];
182
182
  }
@@ -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