@vaadin/multi-select-combo-box 24.6.0-alpha8 → 24.6.0-beta1
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 +16 -15
- package/src/vaadin-lit-multi-select-combo-box-chip.js +79 -0
- package/src/vaadin-lit-multi-select-combo-box-container.js +66 -0
- package/src/vaadin-lit-multi-select-combo-box-internal.js +56 -0
- package/src/vaadin-lit-multi-select-combo-box-item.js +50 -0
- package/src/vaadin-lit-multi-select-combo-box-overlay.js +64 -0
- package/src/vaadin-lit-multi-select-combo-box-scroller.js +96 -0
- package/src/vaadin-lit-multi-select-combo-box.d.ts +1 -0
- package/src/vaadin-lit-multi-select-combo-box.js +146 -0
- package/src/vaadin-multi-select-combo-box-chip.js +6 -27
- package/src/vaadin-multi-select-combo-box-internal-mixin.js +425 -0
- package/src/vaadin-multi-select-combo-box-internal.js +3 -399
- package/src/vaadin-multi-select-combo-box-mixin.d.ts +253 -0
- package/src/vaadin-multi-select-combo-box-mixin.js +1150 -0
- package/src/vaadin-multi-select-combo-box-styles.d.ts +10 -0
- package/src/vaadin-multi-select-combo-box-styles.js +73 -0
- package/src/vaadin-multi-select-combo-box.d.ts +5 -213
- package/src/vaadin-multi-select-combo-box.js +5 -1139
- package/theme/lumo/vaadin-lit-multi-select-combo-box.d.ts +3 -0
- package/theme/lumo/vaadin-lit-multi-select-combo-box.js +3 -0
- package/theme/material/vaadin-lit-multi-select-combo-box.d.ts +3 -0
- package/theme/material/vaadin-lit-multi-select-combo-box.js +3 -0
- package/vaadin-lit-multi-select-combo-box.d.ts +1 -0
- package/vaadin-lit-multi-select-combo-box.js +2 -0
- package/web-types.json +5 -5
- package/web-types.lit.json +8 -8
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const multiSelectComboBox: CSSResult;
|
|
9
|
+
|
|
10
|
+
export const multiSelectComboBoxChip: CSSResult;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
|
+
|
|
8
|
+
export const multiSelectComboBox = css`
|
|
9
|
+
:host {
|
|
10
|
+
--input-min-width: var(--vaadin-multi-select-combo-box-input-min-width, 4em);
|
|
11
|
+
--_chip-min-width: var(--vaadin-multi-select-combo-box-chip-min-width, 50px);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#chips {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::slotted(input) {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
flex: 1 0 var(--input-min-width);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
::slotted([slot='chip']),
|
|
25
|
+
::slotted([slot='overflow']) {
|
|
26
|
+
flex: 0 1 auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
::slotted([slot='chip']) {
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host(:is([readonly], [disabled])) ::slotted(input) {
|
|
34
|
+
flex-grow: 0;
|
|
35
|
+
flex-basis: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([auto-expand-vertically]) #chips {
|
|
40
|
+
display: contents;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([auto-expand-horizontally]) [class$='container'] {
|
|
44
|
+
width: auto;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
export const multiSelectComboBoxChip = css`
|
|
49
|
+
:host {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
align-self: center;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[part='label'] {
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([hidden]),
|
|
63
|
+
:host(:is([readonly], [disabled], [slot='overflow'])) [part='remove-button'] {
|
|
64
|
+
display: none !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (forced-colors: active) {
|
|
68
|
+
:host {
|
|
69
|
+
outline: 1px solid;
|
|
70
|
+
outline-offset: -1px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
@@ -7,11 +7,7 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
|
|
|
7
7
|
import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
8
8
|
import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
9
9
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
10
|
-
import type {
|
|
11
|
-
ComboBoxDataProvider,
|
|
12
|
-
ComboBoxDefaultItem,
|
|
13
|
-
ComboBoxItemModel,
|
|
14
|
-
} from '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
10
|
+
import type { ComboBoxDefaultItem } from '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
15
11
|
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
16
12
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
17
13
|
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -26,20 +22,9 @@ import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
|
|
|
26
22
|
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
|
|
27
23
|
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
28
24
|
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
25
|
+
import type { MultiSelectComboBoxMixinClass } from './vaadin-multi-select-combo-box-mixin.js';
|
|
29
26
|
|
|
30
|
-
export
|
|
31
|
-
root: HTMLElement,
|
|
32
|
-
comboBox: MultiSelectComboBox<TItem>,
|
|
33
|
-
model: ComboBoxItemModel<TItem>,
|
|
34
|
-
) => void;
|
|
35
|
-
|
|
36
|
-
export interface MultiSelectComboBoxI18n {
|
|
37
|
-
cleared: string;
|
|
38
|
-
focused: string;
|
|
39
|
-
selected: string;
|
|
40
|
-
deselected: string;
|
|
41
|
-
total: string;
|
|
42
|
-
}
|
|
27
|
+
export { MultiSelectComboBoxI18n, MultiSelectComboBoxRenderer } from './vaadin-multi-select-combo-box-mixin.js';
|
|
43
28
|
|
|
44
29
|
/**
|
|
45
30
|
* Fired when the user commits a value change.
|
|
@@ -172,200 +157,6 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
|
|
|
172
157
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
173
158
|
*/
|
|
174
159
|
declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLElement {
|
|
175
|
-
/**
|
|
176
|
-
* Set to true to auto expand horizontally, causing input field to
|
|
177
|
-
* grow until max width is reached.
|
|
178
|
-
* @attr {boolean} auto-expand-horizontally
|
|
179
|
-
*/
|
|
180
|
-
autoExpandHorizontally: boolean;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Set to true to not collapse selected items chips into the overflow
|
|
184
|
-
* chip and instead always expand vertically, causing input field to
|
|
185
|
-
* wrap into multiple lines when width is limited.
|
|
186
|
-
* @attr {boolean} auto-expand-vertically
|
|
187
|
-
*/
|
|
188
|
-
autoExpandVertically: boolean;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* When true, the user can input a value that is not present in the items list.
|
|
192
|
-
* @attr {boolean} allow-custom-value
|
|
193
|
-
*/
|
|
194
|
-
allowCustomValue: boolean;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Set true to prevent the overlay from opening automatically.
|
|
198
|
-
* @attr {boolean} auto-open-disabled
|
|
199
|
-
*/
|
|
200
|
-
autoOpenDisabled: boolean;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Function that provides items lazily. Receives two arguments:
|
|
204
|
-
*
|
|
205
|
-
* - `params` - Object with the following properties:
|
|
206
|
-
* - `params.page` Requested page index
|
|
207
|
-
* - `params.pageSize` Current page size
|
|
208
|
-
* - `params.filter` Currently applied filter
|
|
209
|
-
*
|
|
210
|
-
* - `callback(items, size)` - Callback function with arguments:
|
|
211
|
-
* - `items` Current page of items
|
|
212
|
-
* - `size` Total number of items.
|
|
213
|
-
*/
|
|
214
|
-
dataProvider: ComboBoxDataProvider<TItem> | null | undefined;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* A subset of items, filtered based on the user input. Filtered items
|
|
218
|
-
* can be assigned directly to omit the internal filtering functionality.
|
|
219
|
-
* The items can be of either `String` or `Object` type.
|
|
220
|
-
*/
|
|
221
|
-
filteredItems: TItem[] | undefined;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Filtering string the user has typed into the input field.
|
|
225
|
-
*/
|
|
226
|
-
filter: string;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* A full set of items to filter the visible options from.
|
|
230
|
-
* The items can be of either `String` or `Object` type.
|
|
231
|
-
*/
|
|
232
|
-
items: TItem[] | undefined;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* A function used to generate CSS class names for dropdown
|
|
236
|
-
* items and selected chips based on the item. The return
|
|
237
|
-
* value should be the generated class name as a string, or
|
|
238
|
-
* multiple class names separated by whitespace characters.
|
|
239
|
-
*/
|
|
240
|
-
itemClassNameGenerator: (item: TItem) => string;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* The item property used for a visual representation of the item.
|
|
244
|
-
* @attr {string} item-label-path
|
|
245
|
-
*/
|
|
246
|
-
itemLabelPath: string;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Path for the id of the item, used to detect whether the item is selected.
|
|
250
|
-
* @attr {string} item-id-path
|
|
251
|
-
*/
|
|
252
|
-
itemIdPath: string;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Path for the value of the item. If `items` is an array of objects,
|
|
256
|
-
* this property is used as a string value for the selected item.
|
|
257
|
-
* @attr {string} item-value-path
|
|
258
|
-
*/
|
|
259
|
-
itemValuePath: string;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* The object used to localize this component.
|
|
263
|
-
* To change the default localization, replace the entire
|
|
264
|
-
* _i18n_ object or just the property you want to modify.
|
|
265
|
-
*
|
|
266
|
-
* The object has the following JSON structure and default values:
|
|
267
|
-
* ```
|
|
268
|
-
* {
|
|
269
|
-
* // Screen reader announcement on clear button click.
|
|
270
|
-
* cleared: 'Selection cleared',
|
|
271
|
-
* // Screen reader announcement when a chip is focused.
|
|
272
|
-
* focused: ' focused. Press Backspace to remove',
|
|
273
|
-
* // Screen reader announcement when item is selected.
|
|
274
|
-
* selected: 'added to selection',
|
|
275
|
-
* // Screen reader announcement when item is deselected.
|
|
276
|
-
* deselected: 'removed from selection',
|
|
277
|
-
* // Screen reader announcement of the selected items count.
|
|
278
|
-
* // {count} is replaced with the actual count of items.
|
|
279
|
-
* total: '{count} items selected',
|
|
280
|
-
* }
|
|
281
|
-
* ```
|
|
282
|
-
*/
|
|
283
|
-
i18n: MultiSelectComboBoxI18n;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* When true, filter string isn't cleared after selecting an item.
|
|
287
|
-
* @attr {boolean} keep-filter
|
|
288
|
-
*/
|
|
289
|
-
keepFilter: boolean;
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* True when loading items from the data provider, false otherwise.
|
|
293
|
-
*/
|
|
294
|
-
loading: boolean;
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* A space-delimited list of CSS class names to set on the overlay element.
|
|
298
|
-
*
|
|
299
|
-
* @attr {string} overlay-class
|
|
300
|
-
*/
|
|
301
|
-
overlayClass: string;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* True if the dropdown is open, false otherwise.
|
|
305
|
-
*/
|
|
306
|
-
opened: boolean;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Number of items fetched at a time from the data provider.
|
|
310
|
-
* @attr {number} page-size
|
|
311
|
-
*/
|
|
312
|
-
pageSize: number;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* A hint to the user of what can be entered in the control.
|
|
316
|
-
* The placeholder will be only displayed in the case when
|
|
317
|
-
* there is no item selected.
|
|
318
|
-
*/
|
|
319
|
-
placeholder: string;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Custom function for rendering the content of every item.
|
|
323
|
-
* Receives three arguments:
|
|
324
|
-
*
|
|
325
|
-
* - `root` The `<vaadin-multi-select-combo-box-item>` internal container DOM element.
|
|
326
|
-
* - `comboBox` The reference to the `<vaadin-multi-select-combo-box>` element.
|
|
327
|
-
* - `model` The object with the properties related with the rendered
|
|
328
|
-
* item, contains:
|
|
329
|
-
* - `model.index` The index of the rendered item.
|
|
330
|
-
* - `model.item` The item.
|
|
331
|
-
*/
|
|
332
|
-
renderer: MultiSelectComboBoxRenderer<TItem> | null | undefined;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* The list of selected items.
|
|
336
|
-
* Note: modifying the selected items creates a new array each time.
|
|
337
|
-
*/
|
|
338
|
-
selectedItems: TItem[];
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Set to true to group selected items at the top of the overlay.
|
|
342
|
-
* @attr {boolean} selected-items-on-top
|
|
343
|
-
*/
|
|
344
|
-
selectedItemsOnTop: boolean;
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Total number of items.
|
|
348
|
-
*/
|
|
349
|
-
size: number | undefined;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Clears the cached pages and reloads data from data provider when needed.
|
|
353
|
-
*/
|
|
354
|
-
clearCache(): void;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Clears the selected items.
|
|
358
|
-
*/
|
|
359
|
-
clear(): void;
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Requests an update for the content of items.
|
|
363
|
-
* While performing the update, it invokes the renderer (passed in the `renderer` property) once an item.
|
|
364
|
-
*
|
|
365
|
-
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
366
|
-
*/
|
|
367
|
-
requestContentUpdate(): void;
|
|
368
|
-
|
|
369
160
|
addEventListener<K extends keyof MultiSelectComboBoxEventMap<TItem>>(
|
|
370
161
|
type: K,
|
|
371
162
|
listener: (this: MultiSelectComboBox<TItem>, ev: MultiSelectComboBoxEventMap<TItem>[K]) => void,
|
|
@@ -379,7 +170,7 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
|
|
|
379
170
|
): void;
|
|
380
171
|
}
|
|
381
172
|
|
|
382
|
-
interface MultiSelectComboBox
|
|
173
|
+
interface MultiSelectComboBox<TItem = ComboBoxDefaultItem>
|
|
383
174
|
extends ValidateMixinClass,
|
|
384
175
|
SlotStylesMixinClass,
|
|
385
176
|
LabelMixinClass,
|
|
@@ -393,6 +184,7 @@ interface MultiSelectComboBox
|
|
|
393
184
|
DisabledMixinClass,
|
|
394
185
|
DelegateStateMixinClass,
|
|
395
186
|
DelegateFocusMixinClass,
|
|
187
|
+
MultiSelectComboBoxMixinClass<TItem>,
|
|
396
188
|
ResizeMixinClass,
|
|
397
189
|
ThemableMixinClass,
|
|
398
190
|
ThemePropertyMixinClass,
|