parent
1b88a2f7d1
commit
4c8eb6cab2
|
@ -54,6 +54,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
},
|
},
|
||||||
|
dropdownIcon: {
|
||||||
|
type: String,
|
||||||
|
default: undefined
|
||||||
|
},
|
||||||
severity: {
|
severity: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -78,7 +78,7 @@ export interface SplitButtonPassThroughOptions {
|
||||||
* Used to pass attributes to the Button component.
|
* Used to pass attributes to the Button component.
|
||||||
* @see {@link ButtonPassThroughOptions}
|
* @see {@link ButtonPassThroughOptions}
|
||||||
*/
|
*/
|
||||||
menuButton?: ButtonPassThroughOptions<SplitButtonSharedPassThroughMethodOptions>;
|
dropdown?: ButtonPassThroughOptions<SplitButtonSharedPassThroughMethodOptions>;
|
||||||
/**
|
/**
|
||||||
* Used to pass attributes to the TieredMenu component.
|
* Used to pass attributes to the TieredMenu component.
|
||||||
* @see {@link TieredMenuPassThroughOptions}
|
* @see {@link TieredMenuPassThroughOptions}
|
||||||
|
@ -168,6 +168,10 @@ export interface SplitButtonProps {
|
||||||
* @deprecated since v3.27.0. Use 'menubuttonicon' slot.
|
* @deprecated since v3.27.0. Use 'menubuttonicon' slot.
|
||||||
*/
|
*/
|
||||||
menuButtonIcon?: string | undefined;
|
menuButtonIcon?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Name of the menu button icon.
|
||||||
|
*/
|
||||||
|
dropdownIcon?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Defines the style of the button.
|
* Defines the style of the button.
|
||||||
*/
|
*/
|
||||||
|
@ -245,6 +249,7 @@ export interface SplitButtonSlots {
|
||||||
class: string;
|
class: string;
|
||||||
}): VNode[];
|
}): VNode[];
|
||||||
/**
|
/**
|
||||||
|
* @deprecated since v4.0. Use dropdownicon slot instead.
|
||||||
* Custom menu button icon template.
|
* Custom menu button icon template.
|
||||||
* @param {Object} scope - menubuttonicon slot's params.
|
* @param {Object} scope - menubuttonicon slot's params.
|
||||||
*/
|
*/
|
||||||
|
@ -254,6 +259,16 @@ export interface SplitButtonSlots {
|
||||||
*/
|
*/
|
||||||
class: string;
|
class: string;
|
||||||
}): VNode[];
|
}): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom menu button icon template.
|
||||||
|
* @param {Object} scope - menubuttonicon slot's params.
|
||||||
|
*/
|
||||||
|
dropdownicon(scope: {
|
||||||
|
/**
|
||||||
|
* Style class of the icon.
|
||||||
|
*/
|
||||||
|
class: string;
|
||||||
|
}): VNode[];
|
||||||
/**
|
/**
|
||||||
* Custom menu item icon template.
|
* Custom menu item icon template.
|
||||||
* @param {Object} scope - menuitemicon slot's params.
|
* @param {Object} scope - menuitemicon slot's params.
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<PVSButton
|
<PVSButton
|
||||||
ref="button"
|
ref="button"
|
||||||
type="button"
|
type="button"
|
||||||
:class="cx('menuButton')"
|
:class="cx('dropdown')"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
:aria-expanded="isExpanded"
|
:aria-expanded="isExpanded"
|
||||||
|
@ -38,13 +38,17 @@
|
||||||
:text="text"
|
:text="text"
|
||||||
:outlined="outlined"
|
:outlined="outlined"
|
||||||
:size="size"
|
:size="size"
|
||||||
v-bind="menuButtonProps"
|
|
||||||
:pt="ptm('menuButton')"
|
|
||||||
:unstyled="unstyled"
|
:unstyled="unstyled"
|
||||||
|
v-bind="menuButtonProps"
|
||||||
|
:pt="ptm('dropdown')"
|
||||||
>
|
>
|
||||||
<template #icon="slotProps">
|
<template #icon="slotProps">
|
||||||
<slot name="menubuttonicon" :class="slotProps.class">
|
<!--TODO: Deprecated since v4.0-->
|
||||||
<component :is="menuButtonIcon ? 'span' : 'ChevronDownIcon'" :class="[menuButtonIcon, slotProps.class]" v-bind="ptm('menuButton')['icon']" data-pc-section="menubuttonicon" />
|
<slot v-if="$slots.menubuttonicon" name="menubuttonicon" :class="slotProps.class">
|
||||||
|
<component :is="menuButtonIcon ? 'span' : 'ChevronDownIcon'" :class="[menuButtonIcon, slotProps.class]" v-bind="ptm('dropdown')['icon']" data-pc-section="menubuttonicon" />
|
||||||
|
</slot>
|
||||||
|
<slot v-else name="dropdownicon" :class="slotProps.class">
|
||||||
|
<component :is="dropdownIcon ? 'span' : 'ChevronDownIcon'" :class="[dropdownIcon, slotProps.class]" v-bind="ptm('dropdown')['icon']" data-pc-section="menubuttonicon" />
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</PVSButton>
|
</PVSButton>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import BaseStyle from 'primevue/base/style';
|
||||||
const classes = {
|
const classes = {
|
||||||
root: 'p-splitbutton p-component',
|
root: 'p-splitbutton p-component',
|
||||||
button: 'p-splitbutton-button',
|
button: 'p-splitbutton-button',
|
||||||
menuButton: 'p-splitbutton-dropdown'
|
dropdown: 'p-splitbutton-dropdown'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BaseStyle.extend({
|
export default BaseStyle.extend({
|
||||||
|
|
|
@ -3,7 +3,17 @@
|
||||||
<p>The buttons and menuitems have support to display icons.</p>
|
<p>The buttons and menuitems have support to display icons.</p>
|
||||||
</DocSectionText>
|
</DocSectionText>
|
||||||
<div class="card flex justify-content-center">
|
<div class="card flex justify-content-center">
|
||||||
<SplitButton label="Save" icon="pi pi-check" menuButtonIcon="pi pi-cog" @click="save" :model="items" />
|
<SplitButton label="Save" icon="pi pi-check" dropdownIcon="pi pi-cog" @click="save" :model="items" />
|
||||||
|
<SplitButton label="Save" icon="pi pi-check" @click="save" :model="items">
|
||||||
|
<template #dropdownicon>
|
||||||
|
<i class="pi pi-discord"></i>
|
||||||
|
</template>
|
||||||
|
</SplitButton>
|
||||||
|
<SplitButton label="Save" icon="pi pi-check" @click="save" :model="items">
|
||||||
|
<template #menubuttonicon>
|
||||||
|
<i class="pi pi-discord"></i>
|
||||||
|
</template>
|
||||||
|
</SplitButton>
|
||||||
</div>
|
</div>
|
||||||
<DocSectionCode :code="code" />
|
<DocSectionCode :code="code" />
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue