Skip to content

Commit 8772cad

Browse files
committed
fix: align MSCB types to use combo-box mixin classes
1 parent 0ecff9e commit 8772cad

File tree

3 files changed

+26
-81
lines changed

3 files changed

+26
-81
lines changed

packages/multi-select-combo-box/src/vaadin-multi-select-combo-box-mixin.d.ts

Lines changed: 9 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
88
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
99
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
1010
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
11-
import type { ComboBoxDataProvider, ComboBoxItemModel } from '@vaadin/combo-box/src/vaadin-combo-box.js';
11+
import type { ComboBoxItemModel } from '@vaadin/combo-box/src/vaadin-combo-box.js';
12+
import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
13+
import type { ComboBoxDataProviderMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
14+
import type { ComboBoxItemsMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
1215
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
16+
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
1317
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
1418
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
1519
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
@@ -38,6 +42,9 @@ export interface MultiSelectComboBoxI18n {
3842
export declare function MultiSelectComboBoxMixin<TItem, T extends Constructor<HTMLElement>>(
3943
base: T,
4044
): Constructor<ClearButtonMixinClass> &
45+
Constructor<ComboBoxBaseMixinClass> &
46+
Constructor<ComboBoxDataProviderMixinClass<TItem>> &
47+
Constructor<ComboBoxItemsMixinClass<TItem>> &
4148
Constructor<DelegateFocusMixinClass> &
4249
Constructor<DelegateStateMixinClass> &
4350
Constructor<DisabledMixinClass> &
@@ -49,6 +56,7 @@ export declare function MultiSelectComboBoxMixin<TItem, T extends Constructor<HT
4956
Constructor<KeyboardMixinClass> &
5057
Constructor<LabelMixinClass> &
5158
Constructor<MultiSelectComboBoxMixinClass<TItem>> &
59+
Constructor<OverlayClassMixinClass> &
5260
Constructor<ResizeMixinClass> &
5361
Constructor<SlotStylesMixinClass> &
5462
Constructor<ValidateMixinClass> &
@@ -76,44 +84,6 @@ export declare class MultiSelectComboBoxMixinClass<TItem> {
7684
*/
7785
allowCustomValue: boolean;
7886

79-
/**
80-
* Set true to prevent the overlay from opening automatically.
81-
* @attr {boolean} auto-open-disabled
82-
*/
83-
autoOpenDisabled: boolean;
84-
85-
/**
86-
* Function that provides items lazily. Receives two arguments:
87-
*
88-
* - `params` - Object with the following properties:
89-
* - `params.page` Requested page index
90-
* - `params.pageSize` Current page size
91-
* - `params.filter` Currently applied filter
92-
*
93-
* - `callback(items, size)` - Callback function with arguments:
94-
* - `items` Current page of items
95-
* - `size` Total number of items.
96-
*/
97-
dataProvider: ComboBoxDataProvider<TItem> | null | undefined;
98-
99-
/**
100-
* A subset of items, filtered based on the user input. Filtered items
101-
* can be assigned directly to omit the internal filtering functionality.
102-
* The items can be of either `String` or `Object` type.
103-
*/
104-
filteredItems: TItem[] | undefined;
105-
106-
/**
107-
* Filtering string the user has typed into the input field.
108-
*/
109-
filter: string;
110-
111-
/**
112-
* A full set of items to filter the visible options from.
113-
* The items can be of either `String` or `Object` type.
114-
*/
115-
items: TItem[] | undefined;
116-
11787
/**
11888
* A function used to generate CSS class names for dropdown
11989
* items and selected chips based on the item. The return
@@ -122,25 +92,12 @@ export declare class MultiSelectComboBoxMixinClass<TItem> {
12292
*/
12393
itemClassNameGenerator: (item: TItem) => string;
12494

125-
/**
126-
* The item property used for a visual representation of the item.
127-
* @attr {string} item-label-path
128-
*/
129-
itemLabelPath: string;
130-
13195
/**
13296
* Path for the id of the item, used to detect whether the item is selected.
13397
* @attr {string} item-id-path
13498
*/
13599
itemIdPath: string;
136100

137-
/**
138-
* Path for the value of the item. If `items` is an array of objects,
139-
* this property is used as a string value for the selected item.
140-
* @attr {string} item-value-path
141-
*/
142-
itemValuePath: string;
143-
144101
/**
145102
* The object used to localize this component.
146103
* To change the default localization, replace the entire
@@ -176,24 +133,6 @@ export declare class MultiSelectComboBoxMixinClass<TItem> {
176133
*/
177134
loading: boolean;
178135

179-
/**
180-
* A space-delimited list of CSS class names to set on the overlay element.
181-
*
182-
* @attr {string} overlay-class
183-
*/
184-
overlayClass: string;
185-
186-
/**
187-
* True if the dropdown is open, false otherwise.
188-
*/
189-
opened: boolean;
190-
191-
/**
192-
* Number of items fetched at a time from the data provider.
193-
* @attr {number} page-size
194-
*/
195-
pageSize: number;
196-
197136
/**
198137
* A hint to the user of what can be entered in the control.
199138
* The placeholder will be only displayed in the case when
@@ -226,16 +165,6 @@ export declare class MultiSelectComboBoxMixinClass<TItem> {
226165
*/
227166
selectedItemsOnTop: boolean;
228167

229-
/**
230-
* Total number of items.
231-
*/
232-
size: number | undefined;
233-
234-
/**
235-
* Clears the cached pages and reloads data from data provider when needed.
236-
*/
237-
clearCache(): void;
238-
239168
/**
240169
* Clears the selected items.
241170
*/

packages/multi-select-combo-box/src/vaadin-multi-select-combo-box.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js
88
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
99
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
1010
import type { ComboBoxDefaultItem } from '@vaadin/combo-box/src/vaadin-combo-box.js';
11+
import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
12+
import type { ComboBoxDataProviderMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
13+
import type { ComboBoxItemsMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
1114
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
1215
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
16+
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
1317
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
1418
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
1519
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
@@ -169,7 +173,10 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
169173
}
170174

171175
interface MultiSelectComboBox<TItem = ComboBoxDefaultItem>
172-
extends ValidateMixinClass,
176+
extends ComboBoxBaseMixinClass,
177+
ComboBoxDataProviderMixinClass<TItem>,
178+
ComboBoxItemsMixinClass<TItem>,
179+
ValidateMixinClass,
173180
SlotStylesMixinClass,
174181
LabelMixinClass,
175182
KeyboardMixinClass,
@@ -183,6 +190,7 @@ interface MultiSelectComboBox<TItem = ComboBoxDefaultItem>
183190
DelegateStateMixinClass,
184191
DelegateFocusMixinClass,
185192
MultiSelectComboBoxMixinClass<TItem>,
193+
OverlayClassMixinClass,
186194
ResizeMixinClass,
187195
ThemableMixinClass,
188196
ThemePropertyMixinClass,

packages/multi-select-combo-box/test/typings/multi-select-combo-box.types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
22
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
33
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
44
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
5+
import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
6+
import type { ComboBoxDataProviderMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
57
import type {
68
ComboBoxItemMixinClass,
79
ComboBoxItemRenderer,
810
} from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
11+
import type { ComboBoxItemsMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
912
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
1013
import type { DirMixinClass } from '@vaadin/component-base/src/dir-mixin.js';
1114
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
15+
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
1216
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
1317
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
1418
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
@@ -109,6 +113,9 @@ assertType<boolean>(narrowedComboBox.selectedItemsOnTop);
109113
assertType<boolean>(narrowedComboBox.autoExpandVertically);
110114

111115
// Mixins
116+
assertType<ComboBoxBaseMixinClass>(narrowedComboBox);
117+
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBox);
118+
assertType<ComboBoxItemsMixinClass<TestComboBoxItem>>(narrowedComboBox);
112119
assertType<ElementMixinClass>(narrowedComboBox);
113120
assertType<DelegateFocusMixinClass>(narrowedComboBox);
114121
assertType<DelegateStateMixinClass>(narrowedComboBox);
@@ -122,6 +129,7 @@ assertType<Omit<InputMixinClass, 'value'>>(narrowedComboBox);
122129
assertType<KeyboardMixinClass>(narrowedComboBox);
123130
assertType<LabelMixinClass>(narrowedComboBox);
124131
assertType<MultiSelectComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBox);
132+
assertType<OverlayClassMixinClass>(narrowedComboBox);
125133
assertType<SlotStylesMixinClass>(narrowedComboBox);
126134
assertType<ValidateMixinClass>(narrowedComboBox);
127135
assertType<ThemableMixinClass>(narrowedComboBox);

0 commit comments

Comments
 (0)