Skip to content

Commit

Permalink
add slots passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Dec 2, 2024
1 parent fc960e6 commit 84f5f33
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 186 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<h1>c-select slots</h1>
<v-row>
<v-col>
<c-select-many-to-many :model="caseVm" for="caseProducts">
<template #prepend>
<v-chip>v-input</v-chip>
</template>
<template #append-inner>
<v-chip>v-field</v-chip>
</template>
<template #default> Default - shouldn't be seen </template>

<template #selected-item="{ item }">
<div class="bg-purple text-white pa-2 mx-2">{{ item.name }}</div>
</template>
<template #list-item="{ item }">
<div class="bg-indigo text-white pa-2 mx-2">{{ item.name }}</div>
</template>
</c-select-many-to-many>
</v-col>
</v-row>
</template>

<script setup lang="ts">
import { Case, Person } from "@/models.g";
import { CaseViewModel, PersonListViewModel } from "@/viewmodels.g";
import { modelDisplay, useBindToQueryString } from "coalesce-vue";
import { ref } from "vue";
const caseVm = new CaseViewModel();
caseVm.$load(14);
</script>
27 changes: 27 additions & 0 deletions playground/Coalesce.Web.Vue3/src/examples/c-select/styling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@
>
</c-select>

<c-select
:model="caseVm"
for="assignedTo"
prepend-icon="fa fa-circle-chevron-left"
prepend-inner-icon="fa fa-chevron-left"
>
<template #append> sdfsdf </template>
</c-select>

<h1>slots passthrough</h1>
<c-select
:model="caseVm"
for="assignedTo"
prepend-icon="fa fa-circle-chevron-left"
prepend-inner-icon="fa fa-chevron-left"
append-inner-icon="fa fa-chevron-right"
append-icon="fa fa-circle-chevron-right"
>
<template #prepend>
<v-chip>v-input</v-chip>
</template>
<template #append-inner>
<v-chip>v-field</v-chip>
</template>
<template #default> Default - shouldn't be seen </template>
</c-select>

<h1>compact/outlined via v-defaults-provider</h1>
<v-defaults-provider
:defaults="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
:error-messages="error"
:itemTitle="itemText"
:disabled="disabled || forceDisabled"
/>
>
<template v-for="(_, slot) of $slots" v-slot:[slot]="scope">
<slot :name="slot" v-bind="scope" />
</template>
</c-select>
</template>

<script lang="ts" setup generic="TModel extends Model">
Expand Down
Loading

0 comments on commit 84f5f33

Please sign in to comment.