UNPKG

primeng

Version:

PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,

162 lines (157 loc) 8.56 kB
import * as i0 from '@angular/core'; import { Injectable, InjectionToken, inject, input, computed, 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: "22.0.6", ngImport: i0, type: SkeletonStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SkeletonStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", 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 { componentName = 'Skeleton'; $pcSkeleton = inject(SKELETON_INSTANCE, { optional: true, skipSelf: true }) ?? undefined; bindDirectiveInstance = inject(Bind, { self: true }); /** * Shape of the element. * @group Props */ shape = input('rectangle', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ [])); /** * Type of the animation. * @group Props */ animation = input('wave', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "animation" }] : /* istanbul ignore next */ [])); /** * Border radius of the element, defaults to value from theme. * @group Props */ borderRadius = input(/* @ts-ignore */ ...(ngDevMode ? [undefined, { debugName: "borderRadius" }] : /* istanbul ignore next */ [])); /** * Size of the skeleton. * @group Props */ size = input(/* @ts-ignore */ ...(ngDevMode ? [undefined, { debugName: "size" }] : /* istanbul ignore next */ [])); /** * Width of the element. * @group Props */ width = input('100%', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ [])); /** * Height of the element. * @group Props */ height = input('1rem', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ [])); _componentStyle = inject(SkeletonStyle); containerStyle = computed(() => { const inlineStyles = this._componentStyle?.inlineStyles['root']; const size = this.size(); const width = this.width(); const height = this.height(); const borderRadius = this.borderRadius(); if (this.$unstyled()) { return undefined; } if (size) { return { ...inlineStyles, width: size, height: size, borderRadius }; } return { ...inlineStyles, width, height, borderRadius }; }, /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "containerStyle" }] : /* istanbul ignore next */ [])); dataP = computed(() => { const shape = this.shape(); return this.cn({ [shape]: shape }); }, /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "dataP" }] : /* istanbul ignore next */ [])); onAfterViewChecked() { this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root'])); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: Skeleton, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: Skeleton, isStandalone: true, selector: "p-skeleton", inputs: { shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, animation: { classPropertyName: "animation", publicName: "animation", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-hidden": "true", "class": "cx(\"root\")", "style": "containerStyle()", "attr.data-p": "dataP()" } }, 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: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: Skeleton, decorators: [{ type: Component, args: [{ selector: 'p-skeleton', standalone: true, imports: [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]': 'cx("root")', '[style]': 'containerStyle()', '[attr.data-p]': 'dataP()' }, hostDirectives: [Bind] }] }], propDecorators: { shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], animation: [{ type: i0.Input, args: [{ isSignal: true, alias: "animation", required: false }] }], borderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadius", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }] } }); class SkeletonModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SkeletonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule], exports: [Skeleton, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", 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