Refactor #5785 - for OrderList PickList

pull/5806/head
tugcekucukoglu 2024-05-30 14:10:22 +03:00
parent 61b1c592bf
commit 76fc9f54ec
4 changed files with 45 additions and 4 deletions

View File

@ -291,6 +291,7 @@ export interface OrderListSlots {
*/ */
header(): VNode[]; header(): VNode[];
/** /**
* @deprecated since v4.0. Use option slot instead.
* Custom item template. * Custom item template.
* @param {Object} scope - item slot's params. * @param {Object} scope - item slot's params.
*/ */
@ -308,6 +309,24 @@ export interface OrderListSlots {
*/ */
index: number; index: number;
}): VNode[]; }): 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. * Custom controls start template.
*/ */

View File

@ -59,8 +59,9 @@
<slot name="header"></slot> <slot name="header"></slot>
</template> </template>
<template #option="{ option, selected, index }"> <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> </template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox> </Listbox>
</div> </div>
</template> </template>

View File

@ -438,6 +438,7 @@ export interface PickListSlots {
*/ */
header(): VNode[]; header(): VNode[];
/** /**
* @deprecated since v4.0. Use option slot instead.
* Custom item template. * Custom item template.
* @param {Object} scope - item slot's params. * @param {Object} scope - item slot's params.
*/ */
@ -451,7 +452,25 @@ export interface PickListSlots {
*/ */
selected: boolean; 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; index: number;
}): VNode[]; }): VNode[];

View File

@ -60,8 +60,9 @@
<slot name="sourceheader"></slot> <slot name="sourceheader"></slot>
</template> </template>
<template #option="{ option, selected, index }"> <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> </template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox> </Listbox>
</div> </div>
<div :class="cx('transferControls')" v-bind="ptm('transferControls')" data-pc-group-section="controls"> <div :class="cx('transferControls')" v-bind="ptm('transferControls')" data-pc-group-section="controls">
@ -124,8 +125,9 @@
<slot name="targetheader"></slot> <slot name="targetheader"></slot>
</template> </template>
<template #option="{ option, selected, index }"> <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> </template>
<!-- //TODO: item slot deprecated since v4.0. Use option slot. -->
</Listbox> </Listbox>
</div> </div>
<div v-if="showTargetControls" :class="cx('targetControls')" v-bind="ptm('targetControls')" data-pc-group-section="controls"> <div v-if="showTargetControls" :class="cx('targetControls')" v-bind="ptm('targetControls')" data-pc-group-section="controls">