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,

161 lines (156 loc) 8.23 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, BindModule } from 'primeng/bind'; import { style } from '@primeuix/styles/divider'; import { BaseStyle } from 'primeng/base'; /* Position */ const inlineStyles = { root: ({ instance }) => { const layout = instance.layout(); const align = instance.align(); return { justifyContent: layout === 'horizontal' ? (align === 'center' || align == null ? 'center' : align === 'left' ? 'flex-start' : align === 'right' ? 'flex-end' : null) : null, alignItems: layout === 'vertical' ? (align === 'center' || align == null ? 'center' : align === 'top' ? 'flex-start' : align === 'bottom' ? 'flex-end' : null) : null }; } }; const classes = { root: ({ instance }) => { const layout = instance.layout(); const type = instance.type(); const align = instance.align(); return [ 'p-divider p-component', 'p-divider-' + layout, 'p-divider-' + type, { 'p-divider-left': layout === 'horizontal' && (!align || align === 'left') }, { 'p-divider-center': layout === 'horizontal' && align === 'center' }, { 'p-divider-right': layout === 'horizontal' && align === 'right' }, { 'p-divider-top': layout === 'vertical' && align === 'top' }, { 'p-divider-center': layout === 'vertical' && (!align || align === 'center') }, { 'p-divider-bottom': layout === 'vertical' && align === 'bottom' } ]; }, content: 'p-divider-content' }; class DividerStyle extends BaseStyle { name = 'divider'; style = style; classes = classes; inlineStyles = inlineStyles; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerStyle, decorators: [{ type: Injectable }] }); /** * * Divider is used to separate contents. * * [Live Demo](https://primeng.dev/divider) * * @module dividerstyle * */ var DividerClasses; (function (DividerClasses) { /** * Class name of the root element */ DividerClasses["root"] = "p-divider"; /** * Class name of the content element */ DividerClasses["content"] = "p-divider-content"; })(DividerClasses || (DividerClasses = {})); const DIVIDER_INSTANCE = new InjectionToken('DIVIDER_INSTANCE'); /** * Divider is used to separate contents. * @group Components */ class Divider extends BaseComponent { componentName = 'Divider'; $pcDivider = inject(DIVIDER_INSTANCE, { optional: true, skipSelf: true }) ?? undefined; bindDirectiveInstance = inject(Bind, { self: true }); /** * Specifies the orientation. * @group Props */ layout = input('horizontal', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ [])); /** * Border style type. * @group Props */ type = input('solid', /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ [])); /** * Alignment of the content. * @group Props */ align = input(/* @ts-ignore */ ...(ngDevMode ? [undefined, { debugName: "align" }] : /* istanbul ignore next */ [])); _componentStyle = inject(DividerStyle); dataP = computed(() => { return this.cn({ [this.align()]: this.align(), [this.layout()]: this.layout(), [this.type()]: this.type() }); }, /* @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: Divider, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: Divider, isStandalone: true, selector: "p-divider", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "attr.aria-orientation": "layout()", "class": "cx('root')", "style": "sx('root')", "attr.data-p": "dataP()" } }, providers: [DividerStyle, { provide: DIVIDER_INSTANCE, useExisting: Divider }, { provide: PARENT_INSTANCE, useExisting: Divider }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: ` <div [pBind]="ptm('content')" [class]="cx('content')"> <ng-content></ng-content> </div> `, isInline: true, dependencies: [{ kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: BindModule }, { kind: "directive", type: i1.Bind, selector: "[pBind]", inputs: ["pBind"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: Divider, decorators: [{ type: Component, args: [{ selector: 'p-divider', standalone: true, imports: [SharedModule, BindModule], template: ` <div [pBind]="ptm('content')" [class]="cx('content')"> <ng-content></ng-content> </div> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { '[attr.aria-orientation]': 'layout()', role: 'separator', '[class]': "cx('root')", '[style]': "sx('root')", '[attr.data-p]': 'dataP()' }, providers: [DividerStyle, { provide: DIVIDER_INSTANCE, useExisting: Divider }, { provide: PARENT_INSTANCE, useExisting: Divider }], hostDirectives: [Bind] }] }], propDecorators: { layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } }); class DividerModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: DividerModule, imports: [Divider, BindModule], exports: [Divider, BindModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerModule, imports: [Divider, BindModule, BindModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DividerModule, decorators: [{ type: NgModule, args: [{ imports: [Divider, BindModule], exports: [Divider, BindModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { Divider, DividerClasses, DividerModule, DividerStyle }; //# sourceMappingURL=primeng-divider.mjs.map