Refactor #3832 Refactor #3833 - For OrderList

pull/3853/head
Tuğçe Küçükoğlu 2023-04-07 09:47:23 +03:00
parent 30beabe7b8
commit 5017cedd0b
3 changed files with 65 additions and 9 deletions

View File

@ -93,19 +93,35 @@ const OrderListEvents = [
const OrderListSlots = [ const OrderListSlots = [
{ {
name: 'header', name: 'header',
description: "Custom content for the component's header" description: "Custom content for the component's header."
}, },
{ {
name: 'item', name: 'item',
description: 'Custom content for the item' description: 'Custom content for the item.'
}, },
{ {
name: 'controlsstart', name: 'controlsstart',
description: 'Custom content before the buttons' description: 'Custom content before the buttons.'
}, },
{ {
name: 'controlsend', name: 'controlsend',
description: 'Custom content after the buttons' description: 'Custom content after the buttons.'
},
{
name: 'movetopicon',
description: 'Custom move top icon template.'
},
{
name: 'moveupicon',
description: 'Custom move up icon template.'
},
{
name: 'movedownicon',
description: 'Custom move down icon template.'
},
{
name: 'movebottomicon',
description: 'Custom move bottom icon template.'
} }
]; ];

View File

@ -149,6 +149,22 @@ export interface OrderListSlots {
* Custom controls end template. * Custom controls end template.
*/ */
controlsend(): VNode[]; controlsend(): VNode[];
/**
* Custom move up icon template.
*/
moveupicon(): VNode[];
/**
* Custom move top icon template.
*/
movetopicon(): VNode[];
/**
* Custom move down icon template.
*/
movedownicon(): VNode[];
/**
* Custom move bottom icon template.
*/
movebottomicon(): VNode[];
} }
/** /**

View File

@ -2,10 +2,26 @@
<div :class="containerClass"> <div :class="containerClass">
<div class="p-orderlist-controls"> <div class="p-orderlist-controls">
<slot name="controlsstart"></slot> <slot name="controlsstart"></slot>
<OLButton type="button" icon="pi pi-angle-up" @click="moveUp" :aria-label="moveUpAriaLabel" :disabled="moveDisabled()" v-bind="moveUpButtonProps"></OLButton> <OLButton type="button" @click="moveUp" :aria-label="moveUpAriaLabel" :disabled="moveDisabled()" v-bind="moveUpButtonProps">
<OLButton type="button" icon="pi pi-angle-double-up" @click="moveTop" :aria-label="moveTopAriaLabel" :disabled="moveDisabled()" v-bind="moveTopButtonProps"></OLButton> <slot>
<OLButton type="button" icon="pi pi-angle-down" @click="moveDown" :aria-label="moveDownAriaLabel" :disabled="moveDisabled()" v-bind="moveDownButtonProps"></OLButton> <component :is="$slots.moveupicon || 'AngleUpIcon'" />
<OLButton type="button" icon="pi pi-angle-double-down" @click="moveBottom" :aria-label="moveBottomAriaLabel" :disabled="moveDisabled()" v-bind="moveBottomButtonProps"></OLButton> </slot>
</OLButton>
<OLButton type="button" @click="moveTop" :aria-label="moveTopAriaLabel" :disabled="moveDisabled()" v-bind="moveTopButtonProps">
<slot name="movetopicon">
<AngleDoubleUpIcon />
</slot>
</OLButton>
<OLButton type="button" @click="moveDown" :aria-label="moveDownAriaLabel" :disabled="moveDisabled()" v-bind="moveDownButtonProps">
<slot name="movedownicon">
<AngleDownIcon />
</slot>
</OLButton>
<OLButton type="button" @click="moveBottom" :aria-label="moveBottomAriaLabel" :disabled="moveDisabled()" v-bind="moveBottomButtonProps">
<slot name="movebottomicon">
<AngleDoubleDownIcon />
</slot>
</OLButton>
<slot name="controlsend"></slot> <slot name="controlsend"></slot>
</div> </div>
<div class="p-orderlist-list-container"> <div class="p-orderlist-list-container">
@ -42,6 +58,10 @@
<script> <script>
import Button from 'primevue/button'; import Button from 'primevue/button';
import AngleDoubleDownIcon from 'primevue/icon/angledoubledown';
import AngleDoubleUpIcon from 'primevue/icon/angledoubleup';
import AngleDownIcon from 'primevue/icon/angledown';
import AngleUpIcon from 'primevue/icon/angleup';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { DomHandler, ObjectUtils, UniqueComponentId } from 'primevue/utils'; import { DomHandler, ObjectUtils, UniqueComponentId } from 'primevue/utils';
@ -578,7 +598,11 @@ export default {
} }
}, },
components: { components: {
OLButton: Button OLButton: Button,
AngleUpIcon: AngleUpIcon,
AngleDownIcon: AngleDownIcon,
AngleDoubleUpIcon: AngleDoubleUpIcon,
AngleDoubleDownIcon: AngleDoubleDownIcon
}, },
directives: { directives: {
ripple: Ripple ripple: Ripple