primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
1,001 lines (986 loc) • 39.9 kB
JavaScript
import * as i1 from '@angular/common';
import { isPlatformBrowser, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, EventEmitter, signal, inject, booleanAttribute, numberAttribute, ContentChildren, ContentChild, ViewChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { uuid, findSingle, find, focus, hasClass } from '@primeuix/utils';
import { SharedModule, PrimeTemplate } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import * as i2 from 'primeng/button';
import { ButtonModule } from 'primeng/button';
import { PlusIcon } from 'primeng/icons';
import { Ripple } from 'primeng/ripple';
import * as i3 from 'primeng/tooltip';
import { TooltipModule } from 'primeng/tooltip';
import { asapScheduler } from 'rxjs';
import { BaseStyle } from 'primeng/base';
const theme = ({ dt }) => `
.p-speeddial {
position: static;
display: flex;
gap: ${dt('speeddial.gap')};
}
.p-speeddial-button {
z-index: 1;
}
.p-speeddial-button.p-speeddial-rotate {
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, background ${dt('speeddial.transition.duration')}, color ${dt('speeddial.transition.duration')}, border-color ${dt('speeddial.transition.duration')},
box-shadow ${dt('speeddial.transition.duration')}, outline-color ${dt('speeddial.transition.duration')};
will-change: transform;
}
.p-speeddial-list {
margin: 0;
padding: 0;
list-style: none;
display: flex;
align-items: center;
justify-content: center;
transition: top 0s linear ${dt('speeddial.transition.duration')};
pointer-events: none;
outline: 0 none;
z-index: 2;
gap: ${dt('speeddial.gap')};
}
.p-speeddial-item {
transform: scale(0);
opacity: 0;
transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;
will-change: transform;
}
.p-speeddial-circle .p-speeddial-item,
.p-speeddial-semi-circle .p-speeddial-item,
.p-speeddial-quarter-circle .p-speeddial-item {
position: absolute;
}
.p-speeddial-mask {
position: absolute;
inset-inline-start: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
background: ${dt('mask.background')};
border-radius: 6px;
transition: opacity 150ms;
}
.p-speeddial-mask-visible {
pointer-events: none;
opacity: 1;
transition: opacity 150ms;
}
.p-speeddial-open .p-speeddial-list {
pointer-events: auto;
}
.p-speeddial-open .p-speeddial-item {
transform: scale(1);
opacity: 1;
}
.p-speeddial-open .p-speeddial-rotate {
transform: rotate(45deg);
}
`;
/* Direction */
const inlineStyles = {
root: ({ props }) => ({
alignItems: (props.direction === 'up' || props.direction === 'down') && 'center',
justifyContent: (props.direction === 'left' || props.direction === 'right') && 'center',
flexDirection: props.direction === 'up' ? 'column-reverse' : props.direction === 'down' ? 'column' : props.direction === 'left' ? 'row-reverse' : props.direction === 'right' ? 'row' : null
}),
list: ({ props }) => ({
flexDirection: props.direction === 'up' ? 'column-reverse' : props.direction === 'down' ? 'column' : props.direction === 'left' ? 'row-reverse' : props.direction === 'right' ? 'row' : null
})
};
const classes = {
root: ({ instance, props }) => [
`p-speeddial p-component p-speeddial-${props.type}`,
{
[`p-speeddial-direction-${props.direction}`]: props.type !== 'circle',
'p-speeddial-open': instance.d_visible,
'p-disabled': props.disabled
}
],
pcButton: ({ props }) => [
'p-speeddial-button',
{
'p-speeddial-rotate': props.rotateAnimation && !props.hideIcon
}
],
list: 'p-speeddial-list',
item: 'p-speeddial-item',
action: 'p-speeddial-action',
actionIcon: 'p-speeddial-action-icon',
mask: ({ instance }) => [
'p-speeddial-mask',
{
'p-speeddial-mask-visible': instance.d_visible
}
]
};
class SpeedDialStyle extends BaseStyle {
name = 'speeddial';
theme = theme;
classes = classes;
inlineStyles = inlineStyles;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialStyle });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialStyle, decorators: [{
type: Injectable
}] });
/**
*
* When pressed, a floating action button can display multiple primary actions that can be performed on a page.
*
* [Live Demo](https://www.primeng.org/speeddial/)
*
* @module speeddialstyle
*
*/
var SpeedDialClasses;
(function (SpeedDialClasses) {
/**
* Class name of the root element
*/
SpeedDialClasses["root"] = "p-speeddial";
/**
* Class name of the button element
*/
SpeedDialClasses["pcButton"] = "p-speeddial-button";
/**
* Class name of the list element
*/
SpeedDialClasses["list"] = "p-speeddial-list";
/**
* Class name of the item element
*/
SpeedDialClasses["item"] = "p-speeddial-item";
/**
* Class name of the action element
*/
SpeedDialClasses["action"] = "p-speeddial-action";
/**
* Class name of the action icon element
*/
SpeedDialClasses["actionIcon"] = "p-speeddial-action-icon";
/**
* Class name of the mask element
*/
SpeedDialClasses["mask"] = "p-speeddial-mask";
})(SpeedDialClasses || (SpeedDialClasses = {}));
/**
* When pressed, a floating action button can display multiple primary actions that can be performed on a page.
* @group Components
*/
class SpeedDial extends BaseComponent {
/**
* List of items id.
* @group Props
*/
id;
/**
* MenuModel instance to define the action items.
* @group Props
*/
model = null;
/**
* Specifies the visibility of the overlay.
* @defaultValue false
* @group Props
*/
get visible() {
return this._visible;
}
set visible(value) {
this._visible = value;
if (this._visible) {
this.bindDocumentClickListener();
}
else {
this.unbindDocumentClickListener();
}
}
/**
* Inline style of the element.
* @group Props
*/
style;
/**
* Style class of the element.
* @group Props
*/
className;
/**
* Specifies the opening direction of actions.
* @gruop Props
*/
direction = 'up';
/**
* Transition delay step for each action item.
* @group Props
*/
transitionDelay = 30;
/**
* Specifies the opening type of actions.
* @group Props
*/
type = 'linear';
/**
* Radius for *circle types.
* @group Props
*/
radius = 0;
/**
* Whether to show a mask element behind the speeddial.
* @group Props
*/
mask = false;
/**
* Whether the component is disabled.
* @group Props
*/
disabled = false;
/**
* Whether the actions close when clicked outside.
* @group Props
*/
hideOnClickOutside = true;
/**
* Inline style of the button element.
* @group Props
*/
buttonStyle;
/**
* Style class of the button element.
* @group Props
*/
buttonClassName;
/**
* Inline style of the mask element.
* @group Props
*/
maskStyle;
/**
* Style class of the mask element.
* @group Props
*/
maskClassName;
/**
* Show icon of the button element.
* @group Props
*/
showIcon;
/**
* Hide icon of the button element.
* @group Props
*/
hideIcon;
/**
* Defined to rotate showIcon when hideIcon is not present.
* @group Props
*/
rotateAnimation = true;
/**
* Defines a string value that labels an interactive element.
* @group Props
*/
ariaLabel;
/**
* Identifier of the underlying input element.
* @group Props
*/
ariaLabelledBy;
/**
* 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'.
* @group Props
*/
tooltipOptions;
/**
* Used to pass all properties of the ButtonProps to the Button component.
* @group Props
*/
buttonProps;
/**
* Fired when the visibility of element changed.
* @param {boolean} boolean - Visibility value.
* @group Emits
*/
onVisibleChange = new EventEmitter();
/**
* Fired when the visibility of element changed.
* @param {boolean} boolean - Visibility value.
* @group Emits
*/
visibleChange = new EventEmitter();
/**
* Fired when the button element clicked.
* @param {MouseEvent} event - Mouse event.
* @group Emits
*/
onClick = new EventEmitter();
/**
* Fired when the actions are visible.
* @param {Event} event - Browser event.
* @group Emits
*/
onShow = new EventEmitter();
/**
* Fired when the actions are hidden.
* @param {Event} event - Browser event.
* @group Emits
*/
onHide = new EventEmitter();
container;
list;
/**
* Template of the button.
* @group Templates
*/
buttonTemplate;
/**
* Template of the item.
* @group Templates
*/
itemTemplate;
/**
* Template of the item.
* @group Templates
*/
iconTemplate;
templates;
_buttonTemplate;
_itemTemplate;
_iconTemplate;
isItemClicked = false;
_visible = false;
documentClickListener;
focusedOptionIndex = signal(null);
focused = false;
_componentStyle = inject(SpeedDialStyle);
get focusedOptionId() {
return this.focusedOptionIndex() !== -1 ? this.focusedOptionIndex() : null;
}
// @todo rootStyles & listStyles will be refactored in the future in passthrough implementation.
get rootStyles() {
const _style = this._componentStyle?.inlineStyles['root'];
return _style ? _style({ props: this }) : {};
}
get listStyles() {
const _style = this._componentStyle?.inlineStyles['list'];
return _style ? _style({ props: this }) : {};
}
getTooltipOptions(item) {
return { ...this.tooltipOptions, tooltipLabel: item.label, disabled: !this.tooltipOptions };
}
ngOnInit() {
super.ngOnInit();
this.id = this.id || uuid('pn_id_');
}
ngAfterViewInit() {
super.ngAfterViewInit();
if (isPlatformBrowser(this.platformId)) {
if (this.type !== 'linear') {
const button = findSingle(this.container?.nativeElement, '.p-speeddial-button');
const firstItem = findSingle(this.list?.nativeElement, '.p-speeddial-item');
if (button && firstItem) {
const wDiff = Math.abs(button.offsetWidth - firstItem.offsetWidth);
const hDiff = Math.abs(button.offsetHeight - firstItem.offsetHeight);
this.list?.nativeElement.style.setProperty('--item-diff-x', `${wDiff / 2}px`);
this.list?.nativeElement.style.setProperty('--item-diff-y', `${hDiff / 2}px`);
}
}
}
}
ngAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
case 'button':
this._buttonTemplate = item.template;
break;
case 'item':
this._itemTemplate = item.template;
break;
case 'icon':
this._iconTemplate = item.template;
break;
}
});
}
show() {
this.onVisibleChange.emit(true);
this.visibleChange.emit(true);
this._visible = true;
this.onShow.emit();
this.bindDocumentClickListener();
this.cd.markForCheck();
}
hide() {
this.onVisibleChange.emit(false);
this.visibleChange.emit(false);
this._visible = false;
this.onHide.emit();
this.unbindDocumentClickListener();
this.cd.markForCheck();
}
onButtonClick(event) {
this.visible ? this.hide() : this.show();
this.onClick.emit(event);
this.isItemClicked = true;
}
onItemClick(e, item) {
if (item.command) {
item.command({ originalEvent: e, item });
}
this.hide();
this.isItemClicked = true;
}
onKeyDown(event) {
switch (event.code) {
case 'ArrowDown':
this.onArrowDown(event);
break;
case 'ArrowUp':
this.onArrowUp(event);
break;
case 'ArrowLeft':
this.onArrowLeft(event);
break;
case 'ArrowRight':
this.onArrowRight(event);
break;
case 'Enter':
case 'Space':
this.onEnterKey(event);
break;
case 'Escape':
this.onEscapeKey(event);
break;
case 'Home':
this.onHomeKey(event);
break;
case 'End':
this.onEndKey(event);
break;
default:
break;
}
}
onFocus(event) {
this.focused = true;
}
onBlur(event) {
this.focused = false;
asapScheduler.schedule(() => this.focusedOptionIndex.set(-1));
}
onArrowUp(event) {
if (this.direction === 'up') {
this.navigateNextItem(event);
}
else if (this.direction === 'down') {
this.navigatePrevItem(event);
}
else {
this.navigateNextItem(event);
}
}
onArrowDown(event) {
if (this.direction === 'up') {
this.navigatePrevItem(event);
}
else if (this.direction === 'down') {
this.navigateNextItem(event);
}
else {
this.navigatePrevItem(event);
}
}
onArrowLeft(event) {
const leftValidDirections = ['left', 'up-right', 'down-left'];
const rightValidDirections = ['right', 'up-left', 'down-right'];
if (leftValidDirections.includes(this.direction)) {
this.navigateNextItem(event);
}
else if (rightValidDirections.includes(this.direction)) {
this.navigatePrevItem(event);
}
else {
this.navigatePrevItem(event);
}
}
onArrowRight(event) {
const leftValidDirections = ['left', 'up-right', 'down-left'];
const rightValidDirections = ['right', 'up-left', 'down-right'];
if (leftValidDirections.includes(this.direction)) {
this.navigatePrevItem(event);
}
else if (rightValidDirections.includes(this.direction)) {
this.navigateNextItem(event);
}
else {
this.navigateNextItem(event);
}
}
onEndKey(event) {
event.preventDefault();
this.focusedOptionIndex.set(-1);
this.navigatePrevItem(event);
}
onHomeKey(event) {
event.preventDefault();
this.focusedOptionIndex.set(-1);
this.navigateNextItem(event);
}
onEnterKey(event) {
const items = find(this.container.nativeElement, '[data-pc-section="menuitem"]');
const itemIndex = [...items].findIndex((item) => item.id === this.focusedOptionIndex());
this.onItemClick(event, this.model[itemIndex]);
this.onBlur(event);
const buttonEl = findSingle(this.container.nativeElement, 'button');
buttonEl && focus(buttonEl);
}
onEscapeKey(event) {
this.hide();
const buttonEl = findSingle(this.container.nativeElement, 'button');
buttonEl && focus(buttonEl);
}
onTogglerKeydown(event) {
switch (event.code) {
case 'ArrowDown':
case 'ArrowLeft':
this.onTogglerArrowDown(event);
break;
case 'ArrowUp':
case 'ArrowRight':
this.onTogglerArrowUp(event);
break;
case 'Escape':
this.onEscapeKey(event);
break;
default:
break;
}
}
onTogglerArrowUp(event) {
this.focused = true;
focus(this.list.nativeElement);
this.show();
this.navigatePrevItem(event);
event.preventDefault();
}
onTogglerArrowDown(event) {
this.focused = true;
focus(this.list.nativeElement);
this.show();
this.navigateNextItem(event);
event.preventDefault();
}
navigateNextItem(event) {
const optionIndex = this.findNextOptionIndex(this.focusedOptionIndex());
this.changeFocusedOptionIndex(optionIndex);
event.preventDefault();
}
navigatePrevItem(event) {
const optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex());
this.changeFocusedOptionIndex(optionIndex);
event.preventDefault();
}
findPrevOptionIndex(index) {
const items = find(this.container.nativeElement, '[data-pc-section="menuitem"]');
const filteredItems = [...items].filter((item) => !hasClass(findSingle(item, 'a'), 'p-disabled'));
const newIndex = index === -1 ? filteredItems[filteredItems.length - 1].id : index;
let matchedOptionIndex = filteredItems.findIndex((link) => link.getAttribute('id') === newIndex);
matchedOptionIndex = index === -1 ? filteredItems.length - 1 : matchedOptionIndex - 1;
return matchedOptionIndex;
}
findNextOptionIndex(index) {
const items = find(this.container.nativeElement, '[data-pc-section="menuitem"]');
const filteredItems = [...items].filter((item) => !hasClass(findSingle(item, 'a'), 'p-disabled'));
const newIndex = index === -1 ? filteredItems[0].id : index;
let matchedOptionIndex = filteredItems.findIndex((link) => link.getAttribute('id') === newIndex);
matchedOptionIndex = index === -1 ? 0 : matchedOptionIndex + 1;
return matchedOptionIndex;
}
changeFocusedOptionIndex(index) {
const items = find(this.container.nativeElement, '[data-pc-section="menuitem"]');
const filteredItems = [...items].filter((item) => !hasClass(findSingle(item, 'a'), 'p-disabled'));
if (filteredItems[index]) {
this.focusedOptionIndex.set(filteredItems[index].getAttribute('id'));
}
}
calculatePointStyle(index) {
const type = this.type;
if (type !== 'linear') {
const length = this.model.length;
const radius = this.radius || length * 20;
if (type === 'circle') {
const step = (2 * Math.PI) / length;
return {
left: `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`,
top: `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`
};
}
else if (type === 'semi-circle') {
const direction = this.direction;
const step = Math.PI / (length - 1);
const x = `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`;
const y = `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`;
if (direction === 'up') {
return { left: x, bottom: y };
}
else if (direction === 'down') {
return { left: x, top: y };
}
else if (direction === 'left') {
return { right: y, top: x };
}
else if (direction === 'right') {
return { left: y, top: x };
}
}
else if (type === 'quarter-circle') {
const direction = this.direction;
const step = Math.PI / (2 * (length - 1));
const x = `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`;
const y = `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`;
if (direction === 'up-left') {
return { right: x, bottom: y };
}
else if (direction === 'up-right') {
return { left: x, bottom: y };
}
else if (direction === 'down-left') {
return { right: y, top: x };
}
else if (direction === 'down-right') {
return { left: y, top: x };
}
}
}
return {};
}
calculateTransitionDelay(index) {
const length = this.model.length;
return (this.visible ? index : length - index - 1) * this.transitionDelay;
}
containerClass() {
return {
['p-speeddial p-component' + ` p-speeddial-${this.type}`]: true,
[`p-speeddial-direction-${this.direction}`]: this.type !== 'circle',
'p-speeddial-open': this.visible,
'p-disabled': this.disabled
};
}
buttonClass() {
const baseClass = 'p-button-icon-only p-speeddial-button p-button-rounded';
const rotateClass = this.rotateAnimation && !this.hideIcon ? 'p-speeddial-rotate' : '';
const customClass = this.buttonClassName ? this.buttonClassName : '';
return `${baseClass} ${rotateClass} ${customClass}`;
}
get buttonIconClass() {
return (!this.visible && this.showIcon) || !this.hideIcon ? this.showIcon : this.hideIcon;
}
getItemStyle(index) {
const transitionDelay = this.calculateTransitionDelay(index);
const pointStyle = this.calculatePointStyle(index);
return {
transitionDelay: `${transitionDelay}ms`,
...pointStyle
};
}
isClickableRouterLink(item) {
return item.routerLink && !this.disabled && !item.disabled;
}
isOutsideClicked(event) {
return this.container && !(this.container.nativeElement.isSameNode(event.target) || this.container.nativeElement.contains(event.target) || this.isItemClicked);
}
bindDocumentClickListener() {
if (isPlatformBrowser(this.platformId)) {
if (!this.documentClickListener && this.hideOnClickOutside) {
this.documentClickListener = this.renderer.listen(this.document, 'click', (event) => {
if (this.visible && this.isOutsideClicked(event)) {
this.hide();
}
this.isItemClicked = false;
});
}
}
}
unbindDocumentClickListener() {
if (this.documentClickListener) {
this.documentClickListener();
this.documentClickListener = null;
}
}
ngOnDestroy() {
this.unbindDocumentClickListener();
super.ngOnDestroy();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDial, deps: null, target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: SpeedDial, isStandalone: true, selector: "p-speeddial, p-speedDial, p-speed-dial", inputs: { id: "id", model: "model", visible: "visible", style: "style", className: "className", direction: "direction", transitionDelay: ["transitionDelay", "transitionDelay", numberAttribute], type: "type", radius: ["radius", "radius", numberAttribute], mask: ["mask", "mask", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], hideOnClickOutside: ["hideOnClickOutside", "hideOnClickOutside", booleanAttribute], buttonStyle: "buttonStyle", buttonClassName: "buttonClassName", maskStyle: "maskStyle", maskClassName: "maskClassName", showIcon: "showIcon", hideIcon: "hideIcon", rotateAnimation: ["rotateAnimation", "rotateAnimation", booleanAttribute], ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", tooltipOptions: "tooltipOptions", buttonProps: "buttonProps" }, outputs: { onVisibleChange: "onVisibleChange", visibleChange: "visibleChange", onClick: "onClick", onShow: "onShow", onHide: "onHide" }, providers: [SpeedDialStyle], queries: [{ propertyName: "buttonTemplate", first: true, predicate: ["button"] }, { propertyName: "itemTemplate", first: true, predicate: ["item"] }, { propertyName: "iconTemplate", first: true, predicate: ["icon"] }, { propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
<div #container [ngClass]="containerClass()" [class]="className" [style]="style" [ngStyle]="rootStyles" [attr.data-pc-name]="'speeddial'" [attr.data-pc-section]="'root'">
<ng-container *ngIf="!buttonTemplate && !_buttonTemplate">
<button
type="button"
pButton
pRipple
[style]="buttonStyle"
[icon]="buttonIconClass"
[class]="buttonClass()"
[disabled]="disabled"
[attr.aria-expanded]="visible"
[attr.aria-haspopup]="true"
[attr.aria-controls]="id + '_list'"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledBy"
(click)="onButtonClick($event)"
(keydown)="onTogglerKeydown($event)"
[attr.data-pc-name]="'button'"
[buttonProps]="buttonProps"
>
<PlusIcon pButtonIcon *ngIf="!buttonIconClass && !iconTemplate && !_iconTemplate" />
<ng-container *ngTemplateOutlet="iconTemplate || _iconTemplate"></ng-container>
</button>
</ng-container>
<ng-container *ngIf="buttonTemplate || _buttonTemplate">
<ng-container *ngTemplateOutlet="buttonTemplate || _buttonTemplate; context: { toggleCallback: onButtonClick.bind(this) }"></ng-container>
</ng-container>
<ul
#list
class="p-speeddial-list"
role="menu"
[id]="id + '_list'"
(focus)="onFocus($event)"
(focusout)="onBlur($event)"
(keydown)="onKeyDown($event)"
[attr.aria-activedescendant]="focused ? focusedOptionId : undefined"
[tabindex]="-1"
[attr.data-pc-section]="'menu'"
[ngStyle]="listStyles"
>
<li
*ngFor="let item of model; let i = index"
[ngStyle]="getItemStyle(i)"
class="p-speeddial-item"
pTooltip
[tooltipOptions]="item.tooltipOptions || getTooltipOptions(item)"
[ngClass]="{ 'p-hidden': item.visible === false, 'p-focus': focusedOptionId == id + '_' + i }"
[id]="id + '_' + i"
[attr.aria-controls]="id + '_item'"
role="menuitem"
[attr.data-pc-section]="'menuitem'"
>
<ng-container *ngIf="itemTemplate || _itemTemplate">
<ng-container *ngTemplateOutlet="itemTemplate || _itemTemplate; context: { $implicit: item, index: i, toggleCallback: onItemClick.bind(this) }"></ng-container>
</ng-container>
<ng-container *ngIf="!itemTemplate && !_itemTemplate">
<button
type="button"
pButton
pRipple
class="p-speeddial-action"
severity="secondary"
[rounded]="true"
size="small"
role="menuitem"
[icon]="item.icon"
(click)="onItemClick($event, item)"
[disabled]="item?.disabled"
(keydown.enter)="onItemClick($event, item)"
[attr.data-pc-section]="'action'"
[attr.aria-label]="item.label"
[attr.tabindex]="item.disabled || !visible ? null : item.tabindex ? item.tabindex : '0'"
></button>
</ng-container>
</li>
</ul>
</div>
<div *ngIf="mask && visible" [ngClass]="{ 'p-speeddial-mask': true, 'p-speeddial-mask-visible': visible }" [class]="maskClassName" [ngStyle]="maskStyle"></div>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "directive", type: i2.ButtonIcon, selector: "[pButtonIcon]" }, { kind: "directive", type: Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: PlusIcon, selector: "PlusIcon" }, { kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDial, decorators: [{
type: Component,
args: [{
selector: 'p-speeddial, p-speedDial, p-speed-dial',
standalone: true,
imports: [CommonModule, ButtonModule, Ripple, TooltipModule, RouterModule, PlusIcon, SharedModule],
template: `
<div #container [ngClass]="containerClass()" [class]="className" [style]="style" [ngStyle]="rootStyles" [attr.data-pc-name]="'speeddial'" [attr.data-pc-section]="'root'">
<ng-container *ngIf="!buttonTemplate && !_buttonTemplate">
<button
type="button"
pButton
pRipple
[style]="buttonStyle"
[icon]="buttonIconClass"
[class]="buttonClass()"
[disabled]="disabled"
[attr.aria-expanded]="visible"
[attr.aria-haspopup]="true"
[attr.aria-controls]="id + '_list'"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledBy"
(click)="onButtonClick($event)"
(keydown)="onTogglerKeydown($event)"
[attr.data-pc-name]="'button'"
[buttonProps]="buttonProps"
>
<PlusIcon pButtonIcon *ngIf="!buttonIconClass && !iconTemplate && !_iconTemplate" />
<ng-container *ngTemplateOutlet="iconTemplate || _iconTemplate"></ng-container>
</button>
</ng-container>
<ng-container *ngIf="buttonTemplate || _buttonTemplate">
<ng-container *ngTemplateOutlet="buttonTemplate || _buttonTemplate; context: { toggleCallback: onButtonClick.bind(this) }"></ng-container>
</ng-container>
<ul
#list
class="p-speeddial-list"
role="menu"
[id]="id + '_list'"
(focus)="onFocus($event)"
(focusout)="onBlur($event)"
(keydown)="onKeyDown($event)"
[attr.aria-activedescendant]="focused ? focusedOptionId : undefined"
[tabindex]="-1"
[attr.data-pc-section]="'menu'"
[ngStyle]="listStyles"
>
<li
*ngFor="let item of model; let i = index"
[ngStyle]="getItemStyle(i)"
class="p-speeddial-item"
pTooltip
[tooltipOptions]="item.tooltipOptions || getTooltipOptions(item)"
[ngClass]="{ 'p-hidden': item.visible === false, 'p-focus': focusedOptionId == id + '_' + i }"
[id]="id + '_' + i"
[attr.aria-controls]="id + '_item'"
role="menuitem"
[attr.data-pc-section]="'menuitem'"
>
<ng-container *ngIf="itemTemplate || _itemTemplate">
<ng-container *ngTemplateOutlet="itemTemplate || _itemTemplate; context: { $implicit: item, index: i, toggleCallback: onItemClick.bind(this) }"></ng-container>
</ng-container>
<ng-container *ngIf="!itemTemplate && !_itemTemplate">
<button
type="button"
pButton
pRipple
class="p-speeddial-action"
severity="secondary"
[rounded]="true"
size="small"
role="menuitem"
[icon]="item.icon"
(click)="onItemClick($event, item)"
[disabled]="item?.disabled"
(keydown.enter)="onItemClick($event, item)"
[attr.data-pc-section]="'action'"
[attr.aria-label]="item.label"
[attr.tabindex]="item.disabled || !visible ? null : item.tabindex ? item.tabindex : '0'"
></button>
</ng-container>
</li>
</ul>
</div>
<div *ngIf="mask && visible" [ngClass]="{ 'p-speeddial-mask': true, 'p-speeddial-mask-visible': visible }" [class]="maskClassName" [ngStyle]="maskStyle"></div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [SpeedDialStyle]
}]
}], propDecorators: { id: [{
type: Input
}], model: [{
type: Input
}], visible: [{
type: Input
}], style: [{
type: Input
}], className: [{
type: Input
}], direction: [{
type: Input
}], transitionDelay: [{
type: Input,
args: [{ transform: numberAttribute }]
}], type: [{
type: Input
}], radius: [{
type: Input,
args: [{ transform: numberAttribute }]
}], mask: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], disabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], hideOnClickOutside: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], buttonStyle: [{
type: Input
}], buttonClassName: [{
type: Input
}], maskStyle: [{
type: Input
}], maskClassName: [{
type: Input
}], showIcon: [{
type: Input
}], hideIcon: [{
type: Input
}], rotateAnimation: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], ariaLabel: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], tooltipOptions: [{
type: Input
}], buttonProps: [{
type: Input
}], onVisibleChange: [{
type: Output
}], visibleChange: [{
type: Output
}], onClick: [{
type: Output
}], onShow: [{
type: Output
}], onHide: [{
type: Output
}], container: [{
type: ViewChild,
args: ['container']
}], list: [{
type: ViewChild,
args: ['list']
}], buttonTemplate: [{
type: ContentChild,
args: ['button', { descendants: false }]
}], itemTemplate: [{
type: ContentChild,
args: ['item', { descendants: false }]
}], iconTemplate: [{
type: ContentChild,
args: ['icon', { descendants: false }]
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}] } });
class SpeedDialModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialModule, imports: [SpeedDial, SharedModule], exports: [SpeedDial, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialModule, imports: [SpeedDial, SharedModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SpeedDialModule, decorators: [{
type: NgModule,
args: [{
imports: [SpeedDial, SharedModule],
exports: [SpeedDial, SharedModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { SpeedDial, SpeedDialClasses, SpeedDialModule, SpeedDialStyle };
//# sourceMappingURL=primeng-speeddial.mjs.map