mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
Type id
as any in ComboBox
, Dropdown
, MultiSelect
(#1019)
Loosen the prop type for `id`, `selectedId` to be `any` instead of a `string`.
This commit is contained in:
parent
144eba1747
commit
1f7b5560a8
11 changed files with 68 additions and 49 deletions
|
@ -1,7 +1,8 @@
|
|||
<script>
|
||||
/**
|
||||
* @typedef {{ id: string; text: string; }} ComboBoxItem
|
||||
* @event {{ selectedId: string; selectedItem: ComboBoxItem }} select
|
||||
* @typedef {any} ComboBoxItemId
|
||||
* @typedef {{ id: ComboBoxItemId; text: string; }} ComboBoxItem
|
||||
* @event {{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }} select
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -18,7 +19,7 @@
|
|||
|
||||
/**
|
||||
* Set the selected item by value id
|
||||
* @type {string}
|
||||
* @type {ComboBoxItemId}
|
||||
*/
|
||||
export let selectedId = undefined;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
/**
|
||||
* @typedef {string} DropdownItemId
|
||||
* @typedef {any} DropdownItemId
|
||||
* @typedef {string} DropdownItemText
|
||||
* @typedef {{ id: DropdownItemId; text: DropdownItemText; }} DropdownItem
|
||||
* @event {{ selectedId: DropdownItemId, selectedItem: DropdownItem }} select
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<script>
|
||||
/**
|
||||
* @typedef {string} MultiSelectItemId
|
||||
* @typedef {any} MultiSelectItemId
|
||||
* @typedef {string} MultiSelectItemText
|
||||
* @typedef {{ id: MultiSelectItemId; text: MultiSelectItemText; }} MultiSelectItem
|
||||
* @event {{ selectedIds: string[]; selected: MultiSelectItem[]; unselected: MultiSelectItem[]; }} select
|
||||
* @event {{ selectedIds: MultiSelectItemId[]; selected: MultiSelectItem[]; unselected: MultiSelectItem[]; }} select
|
||||
* @event {any} clear
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* Override the display of a multiselect item
|
||||
* @type {(item: MultiSelectItem) => string}
|
||||
* @type {(item: MultiSelectItem) => any}
|
||||
*/
|
||||
export let itemToString = (item) => item.text || item.id;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue