Refactor #3832 Refactor #3833 - For TabView

pull/3852/head
Bahadır Sofuoğlu 2023-04-11 10:32:40 +03:00
parent a01b5696fd
commit c35ef2ccd5
3 changed files with 36 additions and 3 deletions

View File

@ -41,6 +41,18 @@ const TabViewProps = [
default: 'null', default: 'null',
description: 'Uses to pass all properties of the HTMLButtonElement to the next button.' description: 'Uses to pass all properties of the HTMLButtonElement to the next button.'
}, },
{
name: 'prevIcon',
type: 'string',
default: 'null',
description: 'Prev icon of the scrollable tabview.'
},
{
name: 'nextIcon',
type: 'string',
default: 'null',
description: 'Next icon of the scrollable tabview.'
},
{ {
name: 'pt', name: 'pt',
type: 'any', type: 'any',

View File

@ -151,6 +151,14 @@ export interface TabViewProps {
* @deprecated since v3.26.0. Use 'pt' property instead. * @deprecated since v3.26.0. Use 'pt' property instead.
*/ */
nextButtonProps?: ButtonHTMLAttributes | undefined; nextButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Prev icon of the scrollable tabview.
*/
prevIcon?: string | undefined;
/**
* Next icon of the scrollable tabview.
*/
nextIcon?: string | undefined;
/** /**
* Uses to pass attributes to DOM elements inside the component. * Uses to pass attributes to DOM elements inside the component.
* @type {TabViewPassThroughOptions} * @type {TabViewPassThroughOptions}

View File

@ -13,7 +13,7 @@
v-bind="{ ...previousButtonProps, ...ptm('prevbutton') }" v-bind="{ ...previousButtonProps, ...ptm('prevbutton') }"
> >
<slot name="previcon"> <slot name="previcon">
<span class="pi pi-chevron-left" aria-hidden="true" v-bind="ptm('previcon')"></span> <component :is="prevIcon ? prevIcon : 'ChevronLeftIcon'" v-bind="ptm('previcon')" aria-hidden="true" />
</slot> </slot>
</button> </button>
<div ref="content" class="p-tabview-nav-content" @scroll="onScroll" v-bind="ptm('navcontent')"> <div ref="content" class="p-tabview-nav-content" @scroll="onScroll" v-bind="ptm('navcontent')">
@ -59,7 +59,7 @@
v-bind="{ ...nextButtonProps, ...ptm('nextbutton') }" v-bind="{ ...nextButtonProps, ...ptm('nextbutton') }"
> >
<slot name="nexticon"> <slot name="nexticon">
<span class="pi pi-chevron-right" aria-hidden="true" v-bind="ptm('nexticon')"></span> <component :is="nextIcon ? nextIcon : 'ChevronRightIcon'" v-bind="ptm('nexticon')" aria-hidden="true" />
</slot> </slot>
</button> </button>
</div> </div>
@ -85,7 +85,8 @@
import BaseComponent from 'primevue/basecomponent'; import BaseComponent from 'primevue/basecomponent';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { DomHandler, UniqueComponentId } from 'primevue/utils'; import { DomHandler, UniqueComponentId } from 'primevue/utils';
import ChevronLeftIcon from 'primevue/icon/chevronleft';
import ChevronRightIcon from 'primevue/icon/chevronright';
export default { export default {
name: 'TabView', name: 'TabView',
extends: BaseComponent, extends: BaseComponent,
@ -118,6 +119,14 @@ export default {
nextButtonProps: { nextButtonProps: {
type: null, type: null,
default: null default: null
},
prevIcon: {
type: String,
default: undefined
},
nextIcon: {
type: String,
default: undefined
} }
}, },
data() { data() {
@ -391,6 +400,10 @@ export default {
}, },
directives: { directives: {
ripple: Ripple ripple: Ripple
},
components: {
ChevronLeftIcon,
ChevronRightIcon
} }
}; };
</script> </script>