UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

118 lines 14.4 kB
/** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ import { NgTemplateOutlet } from '@angular/common'; import { ChangeDetectionStrategy, Component, ContentChildren, Input, TemplateRef, ViewChild } from '@angular/core'; import { defer, merge, of, Subject } from 'rxjs'; import { mergeMap, startWith, takeUntil } from 'rxjs/operators'; import { NzDestroyService } from 'ng-zorro-antd/core/services'; import * as i0 from "@angular/core"; import * as i1 from "ng-zorro-antd/core/services"; export class NzListItemExtraComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemExtraComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: NzListItemExtraComponent, isStandalone: true, selector: "nz-list-item-extra, [nz-list-item-extra]", host: { classAttribute: "ant-list-item-extra" }, exportAs: ["nzListItemExtra"], ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemExtraComponent, decorators: [{ type: Component, args: [{ selector: 'nz-list-item-extra, [nz-list-item-extra]', exportAs: 'nzListItemExtra', changeDetection: ChangeDetectionStrategy.OnPush, template: ` <ng-content></ng-content> `, host: { class: 'ant-list-item-extra' }, standalone: true }] }] }); export class NzListItemActionComponent { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: NzListItemActionComponent, isStandalone: true, selector: "nz-list-item-action", viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], exportAs: ["nzListItemAction"], ngImport: i0, template: ` <ng-template><ng-content></ng-content></ng-template> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemActionComponent, decorators: [{ type: Component, args: [{ selector: 'nz-list-item-action', exportAs: 'nzListItemAction', changeDetection: ChangeDetectionStrategy.OnPush, template: ` <ng-template><ng-content></ng-content></ng-template> `, standalone: true }] }], propDecorators: { templateRef: [{ type: ViewChild, args: [TemplateRef] }] } }); export class NzListItemActionsComponent { constructor(cdr, destroy$) { this.nzActions = []; this.actions = []; this.inputActionChanges$ = new Subject(); this.contentChildrenChanges$ = defer(() => { if (this.nzListItemActions) { return of(null); } return this.initialized.pipe(mergeMap(() => this.nzListItemActions.changes.pipe(startWith(this.nzListItemActions)))); }); this.initialized = new Subject(); merge(this.contentChildrenChanges$, this.inputActionChanges$) .pipe(takeUntil(destroy$)) .subscribe(() => { if (this.nzActions.length) { this.actions = this.nzActions; } else { this.actions = this.nzListItemActions.map(action => action.templateRef); } cdr.detectChanges(); }); } ngOnChanges() { this.inputActionChanges$.next(null); } ngAfterContentInit() { this.initialized.next(); this.initialized.complete(); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemActionsComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.NzDestroyService }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: NzListItemActionsComponent, isStandalone: true, selector: "ul[nz-list-item-actions]", inputs: { nzActions: "nzActions" }, host: { classAttribute: "ant-list-item-action" }, providers: [NzDestroyService], queries: [{ propertyName: "nzListItemActions", predicate: NzListItemActionComponent }], exportAs: ["nzListItemActions"], usesOnChanges: true, ngImport: i0, template: ` @for (i of actions; track i) { <li> <ng-template [ngTemplateOutlet]="i" /> @if (!$last) { <em class="ant-list-item-action-split"></em> } </li> } `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzListItemActionsComponent, decorators: [{ type: Component, args: [{ selector: 'ul[nz-list-item-actions]', exportAs: 'nzListItemActions', changeDetection: ChangeDetectionStrategy.OnPush, template: ` @for (i of actions; track i) { <li> <ng-template [ngTemplateOutlet]="i" /> @if (!$last) { <em class="ant-list-item-action-split"></em> } </li> } `, host: { class: 'ant-list-item-action' }, providers: [NzDestroyService], imports: [NgTemplateOutlet], standalone: true }] }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.NzDestroyService }], propDecorators: { nzActions: [{ type: Input }], nzListItemActions: [{ type: ContentChildren, args: [NzListItemActionComponent] }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1pdGVtLWNlbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9jb21wb25lbnRzL2xpc3QvbGlzdC1pdGVtLWNlbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7OztHQUdHO0FBRUgsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDbkQsT0FBTyxFQUVMLHVCQUF1QixFQUV2QixTQUFTLEVBQ1QsZUFBZSxFQUNmLEtBQUssRUFHTCxXQUFXLEVBQ1gsU0FBUyxFQUNWLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFjLEVBQUUsRUFBRSxPQUFPLEVBQ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