Skip to content

Commit

Permalink
Refactor #5785 - for OrderList PickList
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed May 30, 2024
1 parent 61b1c59 commit 76fc9f5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
19 changes: 19 additions & 0 deletions components/lib/orderlist/OrderList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export interface OrderListSlots {
*/
header(): VNode[];
/**
* @deprecated since v4.0. Use option slot instead.
* Custom item template.
* @param {Object} scope - item slot's params.
*/
Expand All @@ -308,6 +309,24 @@ export interface OrderListSlots {
*/
index: number;
}): VNode[];
/**
* Custom option template.
* @param {Object} scope - option slot's params.
*/
option(scope: {
/**
* Option of the component
*/
option: any;
/**
* Selection state
*/
selected: boolean;
/**
* Index of the option.
*/
index: number;
}): VNode[];
/**
* Custom controls start template.
*/
Expand Down
3 changes: 2 additions & 1 deletion components/lib/orderlist/OrderList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
<slot name="header"></slot>
</template>
<template #option="{ option, selected, index }">
<slot name="item" :item="option" :selected="selected" :index="index" />
<slot :name="$slots.option ? 'option' : 'item'" :item="option" :option="option" :selected="selected" :index="index" />
</template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox>
</div>
</template>
Expand Down
21 changes: 20 additions & 1 deletion components/lib/picklist/PickList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export interface PickListSlots {
*/
header(): VNode[];
/**
* @deprecated since v4.0. Use option slot instead.
* Custom item template.
* @param {Object} scope - item slot's params.
*/
Expand All @@ -451,7 +452,25 @@ export interface PickListSlots {
*/
selected: boolean;
/**
* Index of the item
* Index of the item.
*/
index: number;
}): VNode[];
/**
* Custom option template.
* @param {Object} scope - option slot's params.
*/
option(scope: {
/**
* Option of the component
*/
option: any;
/**
* Selection state
*/
selected: boolean;
/**
* Index of the option.
*/
index: number;
}): VNode[];
Expand Down
6 changes: 4 additions & 2 deletions components/lib/picklist/PickList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@
<slot name="sourceheader"></slot>
</template>
<template #option="{ option, selected, index }">
<slot name="item" :item="option" :selected="selected" :index="index" />
<slot :name="$slots.option ? 'option' : 'item'" :item="option" :option="option" :selected="selected" :index="index" />
</template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox>
</div>
<div :class="cx('transferControls')" v-bind="ptm('transferControls')" data-pc-group-section="controls">
Expand Down Expand Up @@ -124,8 +125,9 @@
<slot name="targetheader"></slot>
</template>
<template #option="{ option, selected, index }">
<slot name="item" :item="option" :selected="selected" :index="index" />
<slot :name="$slots.option ? 'option' : 'item'" :item="option" :option="option" :selected="selected" :index="index" />
</template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox>
</div>
<div v-if="showTargetControls" :class="cx('targetControls')" v-bind="ptm('targetControls')" data-pc-group-section="controls">
Expand Down

0 comments on commit 76fc9f5

Please sign in to comment.