Skip to content

Commit 6e5d8ea

Browse files
authored
fix: add missing combo-box mixin classes (#3082)
1 parent b3be9ea commit 6e5d8ea

3 files changed

Lines changed: 116 additions & 11 deletions

File tree

‎packages/combo-box/src/vaadin-combo-box-light.d.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright (c) 2021 Vaadin Ltd.
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
6+
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
7+
import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
8+
import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
69
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
710
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
811
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
@@ -136,6 +139,9 @@ declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
136139
interface ComboBoxLight<TItem = ComboBoxDefaultItem>
137140
extends ComboBoxDataProviderMixinClass<TItem>,
138141
ComboBoxMixinClass<TItem>,
142+
KeyboardMixinClass,
143+
InputMixinClass,
144+
DisabledMixinClass,
139145
ThemableMixinClass {}
140146

141147
declare global {

‎packages/combo-box/src/vaadin-combo-box.d.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
import { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
7+
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
78
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
9+
import { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
10+
import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
11+
import { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
12+
import { DelegateStateMixinClass } from '@vaadin/field-base/src/delegate-state-mixin.js';
13+
import { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
14+
import { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
815
import { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
16+
import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
17+
import { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
918
import { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js';
19+
import { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
1020
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
1121
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
1222
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
@@ -215,8 +225,18 @@ declare class ComboBox<TItem = ComboBoxDefaultItem> extends HTMLElement {
215225
interface ComboBox<TItem = ComboBoxDefaultItem>
216226
extends ComboBoxDataProviderMixinClass<TItem>,
217227
ComboBoxMixinClass<TItem>,
228+
ValidateMixinClass,
218229
PatternMixinClass,
230+
LabelMixinClass,
231+
KeyboardMixinClass,
232+
InputMixinClass,
219233
InputControlMixinClass,
234+
InputConstraintsMixinClass,
235+
FocusMixinClass,
236+
FieldMixinClass,
237+
DisabledMixinClass,
238+
DelegateStateMixinClass,
239+
DelegateFocusMixinClass,
220240
ThemableMixinClass,
221241
ElementMixinClass,
222242
ControllerMixinClass {}

‎packages/combo-box/test/typings/combo-box.types.ts‎

Lines changed: 90 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
2+
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
23
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
4+
import { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
5+
import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
6+
import { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
7+
import { DelegateStateMixinClass } from '@vaadin/field-base/src/delegate-state-mixin.js';
8+
import { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
9+
import { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
10+
import { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
11+
import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
12+
import { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
13+
import { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js';
14+
import { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
315
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin';
416
import { ComboBoxDataProviderMixinClass } from '../../src/vaadin-combo-box-data-provider-mixin';
517
import { ComboBoxMixinClass } from '../../src/vaadin-combo-box-mixin';
@@ -10,6 +22,7 @@ import {
1022
ComboBoxFilterChangedEvent,
1123
ComboBoxInvalidChangedEvent,
1224
ComboBoxOpenedChangedEvent,
25+
ComboBoxRenderer,
1326
ComboBoxSelectedItemChangedEvent,
1427
ComboBoxValueChangedEvent
1528
} from '../../vaadin-combo-box';
@@ -30,16 +43,11 @@ interface TestComboBoxItem {
3043

3144
const assertType = <TExpected>(actual: TExpected) => actual;
3245

33-
/* ComboBoxElement */
46+
/* ComboBox */
3447
const genericComboBox = document.createElement('vaadin-combo-box');
48+
assertType<ComboBox>(genericComboBox);
3549

3650
const narrowedComboBox = genericComboBox as ComboBox<TestComboBoxItem>;
37-
assertType<ComboBox>(narrowedComboBox);
38-
assertType<ControllerMixinClass>(narrowedComboBox);
39-
assertType<ElementMixinClass>(narrowedComboBox);
40-
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBox);
41-
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBox);
42-
assertType<ThemableMixinClass>(narrowedComboBox);
4351

4452
narrowedComboBox.addEventListener('change', (event) => {
4553
assertType<ComboBoxChangeEvent<TestComboBoxItem>>(event);
@@ -76,14 +84,65 @@ narrowedComboBox.addEventListener('selected-item-changed', (event) => {
7684
assertType<TestComboBoxItem | null | undefined>(event.detail.value);
7785
});
7886

79-
/* ComboBoxLightElement */
87+
// ComboBox properties
88+
assertType<() => boolean>(narrowedComboBox.checkValidity);
89+
assertType<() => boolean>(narrowedComboBox.validate);
90+
assertType<() => void>(narrowedComboBox.close);
91+
assertType<() => void>(narrowedComboBox.open);
92+
assertType<() => void>(narrowedComboBox.requestContentUpdate);
93+
assertType<boolean>(narrowedComboBox.allowCustomValue);
94+
assertType<boolean>(narrowedComboBox.autofocus);
95+
assertType<boolean>(narrowedComboBox.autoselect);
96+
assertType<boolean | null | undefined>(narrowedComboBox.autoOpenDisabled);
97+
assertType<boolean>(narrowedComboBox.opened);
98+
assertType<string>(narrowedComboBox.filter);
99+
assertType<TestComboBoxItem[] | undefined>(narrowedComboBox.filteredItems);
100+
assertType<TestComboBoxItem[] | undefined>(narrowedComboBox.items);
101+
assertType<string | null | undefined>(narrowedComboBox.itemIdPath);
102+
assertType<string>(narrowedComboBox.itemLabelPath);
103+
assertType<string>(narrowedComboBox.itemValuePath);
104+
assertType<boolean>(narrowedComboBox.loading);
105+
assertType<ComboBoxRenderer<TestComboBoxItem> | null | undefined>(narrowedComboBox.renderer);
106+
assertType<TestComboBoxItem | null | undefined>(narrowedComboBox.selectedItem);
107+
assertType<boolean>(narrowedComboBox.invalid);
108+
assertType<HTMLElement | null | undefined>(narrowedComboBox.focusElement);
109+
assertType<boolean>(narrowedComboBox.disabled);
110+
assertType<boolean>(narrowedComboBox.clearButtonVisible);
111+
assertType<string | null | undefined>(narrowedComboBox.errorMessage);
112+
assertType<string>(narrowedComboBox.placeholder);
113+
assertType<string | null | undefined>(narrowedComboBox.helperText);
114+
assertType<string>(narrowedComboBox.pattern);
115+
assertType<boolean | null | undefined>(narrowedComboBox.preventInvalidInput);
116+
assertType<boolean>(narrowedComboBox.readonly);
117+
assertType<string | null | undefined>(narrowedComboBox.label);
118+
assertType<string>(narrowedComboBox.value);
119+
assertType<boolean>(narrowedComboBox.required);
120+
assertType<string>(narrowedComboBox.name);
121+
122+
// ComboBox mixins
123+
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBox);
124+
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBox);
125+
assertType<ControllerMixinClass>(narrowedComboBox);
126+
assertType<ElementMixinClass>(narrowedComboBox);
127+
assertType<DelegateFocusMixinClass>(narrowedComboBox);
128+
assertType<DelegateStateMixinClass>(narrowedComboBox);
129+
assertType<DisabledMixinClass>(narrowedComboBox);
130+
assertType<FieldMixinClass>(narrowedComboBox);
131+
assertType<FocusMixinClass>(narrowedComboBox);
132+
assertType<InputConstraintsMixinClass>(narrowedComboBox);
133+
assertType<InputControlMixinClass>(narrowedComboBox);
134+
assertType<InputMixinClass>(narrowedComboBox);
135+
assertType<KeyboardMixinClass>(narrowedComboBox);
136+
assertType<LabelMixinClass>(narrowedComboBox);
137+
assertType<PatternMixinClass>(narrowedComboBox);
138+
assertType<ValidateMixinClass>(narrowedComboBox);
139+
assertType<ThemableMixinClass>(narrowedComboBox);
140+
141+
/* ComboBoxLight */
80142
const genericComboBoxLight = document.createElement('vaadin-combo-box-light');
81143
assertType<ComboBoxLight>(genericComboBoxLight);
82144

83145
const narrowedComboBoxLight = genericComboBoxLight as ComboBoxLight<TestComboBoxItem>;
84-
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBoxLight);
85-
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBoxLight);
86-
assertType<ThemableMixinClass>(narrowedComboBoxLight);
87146

88147
narrowedComboBoxLight.addEventListener('change', (event) => {
89148
assertType<ComboBoxLightChangeEvent<TestComboBoxItem>>(event);
@@ -119,3 +178,23 @@ narrowedComboBoxLight.addEventListener('selected-item-changed', (event) => {
119178
assertType<ComboBoxLightSelectedItemChangedEvent<TestComboBoxItem>>(event);
120179
assertType<TestComboBoxItem | null | undefined>(event.detail.value);
121180
});
181+
182+
// ComboBoxLight properties
183+
assertType<() => boolean>(narrowedComboBoxLight.checkValidity);
184+
assertType<() => boolean>(narrowedComboBoxLight.validate);
185+
assertType<() => void>(narrowedComboBoxLight.close);
186+
assertType<() => void>(narrowedComboBoxLight.open);
187+
assertType<boolean | null | undefined>(narrowedComboBoxLight.autoOpenDisabled);
188+
assertType<boolean>(narrowedComboBoxLight.opened);
189+
assertType<boolean>(narrowedComboBoxLight.invalid);
190+
assertType<boolean>(narrowedComboBoxLight.disabled);
191+
assertType<boolean>(narrowedComboBoxLight.readonly);
192+
assertType<string>(narrowedComboBoxLight.value);
193+
194+
// ComboBoxLight mixins
195+
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBoxLight);
196+
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBoxLight);
197+
assertType<DisabledMixinClass>(narrowedComboBoxLight);
198+
assertType<InputMixinClass>(narrowedComboBoxLight);
199+
assertType<KeyboardMixinClass>(narrowedComboBoxLight);
200+
assertType<ThemableMixinClass>(narrowedComboBoxLight);

0 commit comments

Comments
 (0)