Skip to content

Commit

Permalink
adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Nov 26, 2024
1 parent 0704bf8 commit c2acd3a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 5.3.0

- Added `multiple` prop to `c-select`, allowing for the selection of multiple models.
- `c-select-many-to-many` is now based on `c-select` rather than `v-autocomplete`. As a result, it has gained support for all of the props and slots of `c-select`.

# 5.2.1

Expand Down
6 changes: 3 additions & 3 deletions docs/stacks/vue/coalesce-vue-vuetify/components/c-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ createMethods = {

## Slots

`#item="{ item, search }"` - Slot used to customize the text of both items inside the list, as well as the text of selected items. By default, items are rendered with [c-display](/stacks/vue/coalesce-vue-vuetify/components/c-display.md). Slot is passed a parameter `item` containing a [model instance](/stacks/vue/layers/models.md), and `search` containing the current search query.
`#item="{ item: TModel, search: string }"` - Slot used to customize the text of both items inside the list, as well as the text of selected items. By default, items are rendered with [c-display](/stacks/vue/coalesce-vue-vuetify/components/c-display.md). Slot is passed a parameter `item` containing a [model instance](/stacks/vue/layers/models.md), and `search` containing the current search query.

`#list-item="{ item, search }"` - Slot used to customize the text of items inside the list. If not provided, falls back to the `item` slot.
`#list-item="{ item: TModel, search: string, selected: boolean }"` - Slot used to customize the text of items inside the list. If not provided, falls back to the `item` slot. Contents are wrapped in a `v-list-item-title`.

`#selected-item="{ item, search }"` - Slot used to customize the text of selected items. If not provided, falls back to the `item` slot.
`#selected-item="{ item: TModel, search: string, remove: () => void }"` - Slot used to customize the text of selected items. If not provided, falls back to the `item` slot. The `remove` function will deselect the item and is only valid when using multi-select.
9 changes: 8 additions & 1 deletion src/coalesce-vue-vuetify3/src/components/input/c-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
v-for="item in internalModelValue"
:key="item[modelObjectMeta.keyProp.name]"
>
<slot name="selected-item" :item="item" :search="search">
<slot
name="selected-item"
:item="item"
:search="search"
:remove="() => onInput(item)"
>
<slot name="item" :item="item" :search="search">
<v-chip
v-if="effectiveMultiple"
Expand Down Expand Up @@ -400,6 +405,8 @@ defineSlots<{
["selected-item"]?(props: {
item: SelectedModelTypeSingle;
search: string | null;
/** Remove/unselect the item. Only applicable for multiselect/multiple mode. */
remove: () => void;
}): any;
["list-item"]?(props: {
item: SelectedModelTypeSingle;
Expand Down

0 comments on commit c2acd3a

Please sign in to comment.