Fixed #1836 - For SpeedDial

pull/1846/head
mertsincan 2021-12-01 17:20:03 +03:00
parent ffd8a07e1e
commit a757e6e2df
1 changed files with 166 additions and 29 deletions

View File

@ -1,39 +1,176 @@
import { VNode } from 'vue'; import { VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
import { MenuItem } from '../menuitem';
interface SpeedDialProps { type SpeedDialDirectionType = 'up' | 'down' | 'left' | 'right' | 'up-left' | 'up-right' | 'down-left' | 'down-right';
model?: any[];
visible?: boolean; type SpeedDialType = 'linear' | 'circle' | 'semi-circle' | 'quarter-circle';
direction?: string;
transitionDelay?: number; type SpeedDialTooltipPositionType = 'bottom' | 'top' | 'left' | 'right';
type?: string;
radius?: number; type SpeedDialTooltipEventType = 'hover' | 'focus';
mask?: boolean;
disabled?: boolean; export interface SpeedDialTooltipOptions {
hideOnClickOutside?: boolean; /**
buttonClass?: string; * Event to show the tooltip, valid values are hover and focus.
maskStyle?: string; * @see SpeedDialTooltipEventType
maskClass?: string; */
showIcon?: string; event: SpeedDialTooltipEventType;
hideIcon?: string; /**
rotateAnimation?: boolean; * Position of element.
class?: string; * @see SpeedDialTooltipPositionType
* Default value is 'bottom'.
*/
position: SpeedDialTooltipPositionType;
/**
* Optional options.
*/
[key: string]: string;
}
export interface SpeedDialProps {
/**
* MenuModel instance to define the action items.
*/
model?: MenuItem[] | undefined;
/**
* Specifies the visibility of the overlay.
*/
visible?: boolean | undefined;
/**
* Specifies the opening direction of actions.
* @see SpeedDialDirectionType
* Default value is 'up'.
*/
direction?: SpeedDialDirectionType;
/**
* Transition delay step for each action item.
* Default value is 30.
*/
transitionDelay?: number | undefined;
/**
* Specifies the opening type of actions.
* @see SpeedDialType
* Default value is 'linear'.
*/
type?: SpeedDialType;
/**
* Radius for *circle types.
* Default value is 0.
*/
radius?: number | undefined;
/**
* Whether to show a mask element behind the speeddial.
*/
mask?: boolean | undefined;
/**
* Whether the component is disabled.
*/
disabled?: boolean | undefined;
/**
* Whether the actions close when clicked outside.
* Default value is true.
*/
hideOnClickOutside?: boolean | undefined;
/**
* Style class of the button element.
*/
buttonClass?: string | undefined;
/**
* Inline style of the mask element.
*/
maskStyle?: any;
/**
* Style class of the mask element.
*/
maskClass?: string | undefined;
/**
* Show icon of the button element.
* Default value is 'pi pi-plus'.
*/
showIcon?: string | undefined;
/**
* Hide icon of the button element.
*/
hideIcon?: string | undefined;
/**
* Defined to rotate showIcon when hideIcon is not present.
* Default value is true.
*/
rotateAnimation?: boolean | undefined;
/**
* Style class of the element.
*/
class?: string | undefined;
/**
* Inline style of the element.
*/
style?: any; style?: any;
tooltipOptions?: any; /**
* Whether to display the tooltip on items. The modifiers of Tooltip can be used like an object in it. Valid keys are 'event' and 'position'.
* @see SpeedDialTooltipOptions
*/
tooltipOptions?: SpeedDialTooltipOptions;
} }
interface SpeedDialItemSlotInterface { export interface SpeedDialSlots {
item: any; /**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
item: (scope: {
/**
* Menuitem instance
*/
item: MenuItem;
}) => VNode[];
/**
* Custom button template.
* @param {Object} scope - button slot's params.
*/
button: (scope: {
/**
* Toggle metadata
*/
toggle: () => void;
}) => VNode[];
} }
declare class SpeedDial { export declare type SpeedDialEmits = {
$props: SpeedDialProps; /**
$emit(eventName: 'click', event: Event): this; * Fired when the button element clicked.
$emit(eventName: 'show'): this; * @param {Event} event - Browser event.
$emit(eventName: 'hide'): this; */
$slots: { 'click': (event: Event) => void;
item: SpeedDialItemSlotInterface; /**
button: VNode[]; * Fired when the actions are visible.
}; */
'show': () => void;
/**
* Fired when the actions are hidden.
*/
'hide': () => void;
} }
declare class SpeedDial extends ClassComponent<SpeedDialProps, SpeedDialSlots, SpeedDialEmits> { }
declare module '@vue/runtime-core' {
interface GlobalComponents {
SpeedDial: GlobalComponentConstructor<SpeedDial>
}
}
/**
*
* When pressed, a floating action button can display multiple primary actions that can be performed on a page.
*
* Helper API:
*
* - [MenuItem](https://www.primefaces.org/primevue/showcase/#/menumodel)
*
* Demos:
*
* - [SpeedDial](https://www.primefaces.org/primevue/showcase/#/speeddial)
*
*/
export default SpeedDial; export default SpeedDial;