@progress/kendo-angular-layout
Version:
Kendo UI for Angular Layout Package - a collection of components to create professional application layoyts
167 lines (162 loc) • 6.98 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, EventEmitter, HostBinding, Input, Output, TemplateRef } from '@angular/core';
import { NgIf, NgFor, NgTemplateOutlet } from '@angular/common';
import * as i0 from "@angular/core";
/**
* Specifies the action buttons of the Card.
* * ([see example]({% slug actions_card %})).
*/
export class CardActionsComponent {
hostClass = true;
get stretchedClass() {
return this.layout === 'stretched';
}
get startClass() {
return this.layout === 'start';
}
get endClass() {
return this.layout === 'end';
}
get centerClass() {
return this.layout === 'center';
}
get verticalClass() {
return this.orientation === 'vertical';
}
get horizontalClass() {
return this.orientation === 'horizontal';
}
/**
* Specifies the layout of the Card action buttons.
*
* * The possible values are:
* * (Default) `horizontal`
* * `vertical`
*
*/
orientation = 'horizontal';
/**
* Specifies the layout of the Card action buttons.
*
* The possible values are:
* * (Default) `start`
* * `center`
* * `end`
* * `stretched`
*
*/
layout = 'start';
/**
* Allows the declarative specification of the Card actions.
*/
set actions(value) {
if (Array.isArray(value)) {
this.actionsArray = value;
}
else if (value instanceof TemplateRef) {
this.actionsTemplate = value;
}
}
/**
* Fires when the user clicks an action button.
*/
action = new EventEmitter();
/**
* @hidden
*/
actionsArray;
/**
* @hidden
*/
actionsTemplate;
/**
* @hidden
*/
onClick(action) {
this.action.emit(action);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CardActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CardActionsComponent, isStandalone: true, selector: "kendo-card-actions", inputs: { orientation: "orientation", layout: "layout", actions: "actions" }, outputs: { action: "action" }, host: { properties: { "class.k-actions": "this.hostClass", "class.k-card-actions": "this.hostClass", "class.k-actions-stretched": "this.stretchedClass", "class.k-actions-start": "this.startClass", "class.k-actions-end": "this.endClass", "class.k-actions-center": "this.centerClass", "class.k-actions-vertical": "this.verticalClass", "class.k-actions-horizontal": "this.horizontalClass" } }, ngImport: i0, template: `
<ng-content *ngIf="!actionsArray && !actionsTemplate"></ng-content>
<ng-container *ngIf="actionsArray">
<button
type="button"
class="k-button k-button-md k-rounded-md"
[ ]="!action.flat"
[ ]="action.flat"
[ ]="!action.primary && !action.flat"
[ ]="action.primary && !action.flat"
[ ]="!action.primary && action.flat"
[ ]="action.primary && action.flat"
(click)="onClick(action)"
*ngFor="let action of actionsArray"
>
<span class="k-button-text">{{ action.text }}</span>
</button>
</ng-container>
<ng-template [ngTemplateOutlet]="actionsTemplate" *ngIf="actionsTemplate"></ng-template>
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CardActionsComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-card-actions',
template: `
<ng-content *ngIf="!actionsArray && !actionsTemplate"></ng-content>
<ng-container *ngIf="actionsArray">
<button
type="button"
class="k-button k-button-md k-rounded-md"
[ ]="!action.flat"
[ ]="action.flat"
[ ]="!action.primary && !action.flat"
[ ]="action.primary && !action.flat"
[ ]="!action.primary && action.flat"
[ ]="action.primary && action.flat"
(click)="onClick(action)"
*ngFor="let action of actionsArray"
>
<span class="k-button-text">{{ action.text }}</span>
</button>
</ng-container>
<ng-template [ngTemplateOutlet]="actionsTemplate" *ngIf="actionsTemplate"></ng-template>
`,
standalone: true,
imports: [NgIf, NgFor, NgTemplateOutlet]
}]
}], propDecorators: { hostClass: [{
type: HostBinding,
args: ['class.k-actions']
}, {
type: HostBinding,
args: ['class.k-card-actions']
}], stretchedClass: [{
type: HostBinding,
args: ['class.k-actions-stretched']
}], startClass: [{
type: HostBinding,
args: ['class.k-actions-start']
}], endClass: [{
type: HostBinding,
args: ['class.k-actions-end']
}], centerClass: [{
type: HostBinding,
args: ['class.k-actions-center']
}], verticalClass: [{
type: HostBinding,
args: ['class.k-actions-vertical']
}], horizontalClass: [{
type: HostBinding,
args: ['class.k-actions-horizontal']
}], orientation: [{
type: Input
}], layout: [{
type: Input
}], actions: [{
type: Input
}], action: [{
type: Output
}] } });