Skip to content

Commit

Permalink
Refactor #5682 - For Paginator, Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed May 6, 2024
1 parent 4c3c2b8 commit ce2e2b7
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 11 deletions.
76 changes: 72 additions & 4 deletions components/lib/paginator/Paginator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,89 @@ export interface PaginatorSlots {
state: PageState;
}): VNode[];
/**
* @deprecated since v4.0. Use 'firsticon' slot instead.
* Custom first page link icon template.
* @param {Object} scope - firstpagelinkicon's params.
*/
firstpagelinkicon(): VNode[];
firstpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom first page link icon template.
* @param {Object} scope - firsticon's params.
*/
firsticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* @deprecated since v4.0. Use 'previcon' slot instead.
* Custom previous page link icon template.
* @param {Object} scope - prevpagelinkicon's params.
*/
prevpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom previous page link icon template.
* @param {Object} scope - previcon's params.
*/
previcon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* @deprecated since v4.0. Use 'nexticon' slot instead.
* Custom finextrst page link icon template.
* @param {Object} scope - nextpagelinkicon's params.
*/
prevpagelinkicon(): VNode[];
nextpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom finextrst page link icon template.
* @param {Object} scope - nexticon's params.
*/
nexticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* @deprecated since v4.0. Use 'lasticon' slot instead.
* Custom last page link icon template.
* @param {Object} scope - lastpagelinkicon's params.
*/
nextpagelinkicon(): VNode[];
lastpagelinkicon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom last page link icon template.
* @param {Object} scope - lasticon's params.
*/
lastpagelinkicon(): VNode[];
lasticon(scope: {
/**
* Style class of the jumptopagedropdown icon.
*/
class: string;
}): VNode[];
/**
* Custom rowsperpagedropdownicon template.
* @param {Object} scope - rowsperpagedropdownicon's params.
Expand Down
40 changes: 36 additions & 4 deletions components/lib/paginator/Paginator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,42 @@
<slot name="start" :state="currentState"></slot>
</div>
<template v-for="item in value" :key="item">
<FirstPageLink v-if="item === 'FirstPageLink'" :aria-label="getAriaLabel('firstPageLabel')" :template="$slots.firstpagelinkicon" @click="changePageToFirst($event)" :disabled="isFirstPage || empty" :unstyled="unstyled" :pt="pt" />
<PrevPageLink v-else-if="item === 'PrevPageLink'" :aria-label="getAriaLabel('prevPageLabel')" :template="$slots.prevpagelinkicon" @click="changePageToPrev($event)" :disabled="isFirstPage || empty" :unstyled="unstyled" :pt="pt" />
<NextPageLink v-else-if="item === 'NextPageLink'" :aria-label="getAriaLabel('nextPageLabel')" :template="$slots.nextpagelinkicon" @click="changePageToNext($event)" :disabled="isLastPage || empty" :unstyled="unstyled" :pt="pt" />
<LastPageLink v-else-if="item === 'LastPageLink'" :aria-label="getAriaLabel('lastPageLabel')" :template="$slots.lastpagelinkicon" @click="changePageToLast($event)" :disabled="isLastPage || empty" :unstyled="unstyled" :pt="pt" />
<FirstPageLink
v-if="item === 'FirstPageLink'"
:aria-label="getAriaLabel('firstPageLabel')"
:template="$slots.firsticon || $slots.firstpagelinkicon"
@click="changePageToFirst($event)"
:disabled="isFirstPage || empty"
:unstyled="unstyled"
:pt="pt"
/>
<PrevPageLink
v-else-if="item === 'PrevPageLink'"
:aria-label="getAriaLabel('prevPageLabel')"
:template="$slots.previcon || $slots.prevpagelinkicon"
@click="changePageToPrev($event)"
:disabled="isFirstPage || empty"
:unstyled="unstyled"
:pt="pt"
/>
<NextPageLink
v-else-if="item === 'NextPageLink'"
:aria-label="getAriaLabel('nextPageLabel')"
:template="$slots.nexticon || $slots.nextpagelinkicon"
@click="changePageToNext($event)"
:disabled="isLastPage || empty"
:unstyled="unstyled"
:pt="pt"
/>
<LastPageLink
v-else-if="item === 'LastPageLink'"
:aria-label="getAriaLabel('lastPageLabel')"
:template="$slots.lasticon || $slots.lastpagelinkicon"
@click="changePageToLast($event)"
:disabled="isLastPage || empty"
:unstyled="unstyled"
:pt="pt"
/>
<PageLinks v-else-if="item === 'PageLinks'" :aria-label="getAriaLabel('pageLabel')" :value="pageLinks" :page="page" @click="changePageLink($event)" :pt="pt" />
<CurrentPageReport
v-else-if="item === 'CurrentPageReport'"
Expand Down
15 changes: 13 additions & 2 deletions components/lib/toast/Toast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,21 @@ export interface ToastSlots {
message: any;
}): VNode[];
/**
* Custom icon template.
* @param {Object} scope - icon slot's params.
* @deprecated since v4.0. Use 'messageicon' slot instead.
* Custom message icon template.
* @param {Object} scope - message icon slot's params.
*/
icon(scope: {
/**
* Style class of the message icon
*/
class: any;
}): VNode[];
/**
* Custom message icon template.
* @param {Object} scope - message icon slot's params.
*/
messageicon(scope: {
/**
* Style class of the icon
*/
Expand Down
2 changes: 1 addition & 1 deletion components/lib/toast/ToastMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<component v-if="templates.container" :is="templates.container" :message="message" :onClose="onCloseClick" :closeCallback="onCloseClick" />
<div v-else :class="[cx('messageContent'), message.contentStyleClass]" v-bind="ptm('messageContent')">
<template v-if="!templates.message">
<component :is="templates.icon ? templates.icon : iconComponent && iconComponent.name ? iconComponent : 'span'" :class="cx('messageIcon')" v-bind="ptm('messageIcon')" />
<component :is="templates.messageicon ? templates.messageicon : templates.icon ? templates.icon : iconComponent && iconComponent.name ? iconComponent : 'span'" :class="cx('messageIcon')" v-bind="ptm('messageIcon')" />
<div :class="cx('messageText')" v-bind="ptm('messageText')">
<span :class="cx('summary')" v-bind="ptm('summary')">{{ message.summary }}</span>
<div :class="cx('detail')" v-bind="ptm('detail')">{{ message.detail }}</div>
Expand Down

0 comments on commit ce2e2b7

Please sign in to comment.