UNPKG

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

162 lines (157 loc) 6.82 kB
import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, InjectionToken, inject, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { SharedModule } from 'primeng/api'; import { BaseComponent, PARENT_INSTANCE } from 'primeng/basecomponent'; import * as i1 from 'primeng/bind'; import { Bind } from 'primeng/bind'; import { style } from '@primeuix/styles/skeleton'; import { BaseStyle } from 'primeng/base'; const inlineStyles = { root: { position: 'relative' } }; const classes = { root: ({ instance }) => [ 'p-skeleton p-component', { 'p-skeleton-circle': instance.shape === 'circle', 'p-skeleton-animation-none': instance.animation === 'none' } ] }; class SkeletonStyle extends BaseStyle { name = 'skeleton'; style = style; classes = classes; inlineStyles = inlineStyles; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonStyle, decorators: [{ type: Injectable }] }); /** * * Skeleton is a placeholder to display instead of the actual content. * * [Live Demo](https://www.primeng.org/skeleton/) * * @module skeletonstyle * */ var SkeletonClasses; (function (SkeletonClasses) { /** * Class name of the root element */ SkeletonClasses["root"] = "p-skeleton"; })(SkeletonClasses || (SkeletonClasses = {})); const SKELETON_INSTANCE = new InjectionToken('SKELETON_INSTANCE'); /** * Skeleton is a placeholder to display instead of the actual content. * @group Components */ class Skeleton extends BaseComponent { $pcSkeleton = inject(SKELETON_INSTANCE, { optional: true, skipSelf: true }) ?? undefined; bindDirectiveInstance = inject(Bind, { self: true }); onAfterViewChecked() { this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root'])); } /** * Class of the element. * @deprecated since v20.0.0, use `class` instead. * @group Props */ styleClass; /** * Shape of the element. * @group Props */ shape = 'rectangle'; /** * Type of the animation. * @gruop Props */ animation = 'wave'; /** * Border radius of the element, defaults to value from theme. * @group Props */ borderRadius; /** * Size of the skeleton. * @group Props */ size; /** * Width of the element. * @group Props */ width = '100%'; /** * Height of the element. * @group Props */ height = '1rem'; _componentStyle = inject(SkeletonStyle); get containerStyle() { const inlineStyles = this._componentStyle?.inlineStyles['root']; let style; if (this.size) style = { ...inlineStyles, width: this.size, height: this.size, borderRadius: this.borderRadius }; else style = { ...inlineStyles, width: this.width, height: this.height, borderRadius: this.borderRadius }; return style; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Skeleton, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.4", type: Skeleton, isStandalone: true, selector: "p-skeleton", inputs: { styleClass: "styleClass", shape: "shape", animation: "animation", borderRadius: "borderRadius", size: "size", width: "width", height: "height" }, host: { properties: { "attr.aria-hidden": "true", "class": "cn(cx('root'), styleClass)", "style": "containerStyle" } }, providers: [SkeletonStyle, { provide: SKELETON_INSTANCE, useExisting: Skeleton }, { provide: PARENT_INSTANCE, useExisting: Skeleton }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Skeleton, decorators: [{ type: Component, args: [{ selector: 'p-skeleton', standalone: true, imports: [CommonModule, SharedModule], template: ``, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [SkeletonStyle, { provide: SKELETON_INSTANCE, useExisting: Skeleton }, { provide: PARENT_INSTANCE, useExisting: Skeleton }], host: { '[attr.aria-hidden]': 'true', '[class]': "cn(cx('root'), styleClass)", '[style]': 'containerStyle' }, hostDirectives: [Bind] }] }], propDecorators: { styleClass: [{ type: Input }], shape: [{ type: Input }], animation: [{ type: Input }], borderRadius: [{ type: Input }], size: [{ type: Input }], width: [{ type: Input }], height: [{ type: Input }] } }); class SkeletonModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule], exports: [Skeleton, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SkeletonModule, decorators: [{ type: NgModule, args: [{ imports: [Skeleton, SharedModule], exports: [Skeleton, SharedModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { Skeleton, SkeletonClasses, SkeletonModule, SkeletonStyle }; //# sourceMappingURL=primeng-skeleton.mjs.map