import * as i1$1 from '@angular/cdk/portal'; import { ComponentPortal, PortalModule } from '@angular/cdk/portal'; import * as i0 from '@angular/core'; import { InjectionToken, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, ChangeDetectorRef, DestroyRef, Input, ViewContainerRef, Injector, TemplateRef, Type, NgModule } from '@angular/core'; import { NzConfigService, onConfigChangeEventForComponent } from 'ng-zorro-antd/core/config'; import * as i1 from 'ng-zorro-antd/core/outlet'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { NzI18nService } from 'ng-zorro-antd/i18n'; /** * 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 */ /** * 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 */ const NZ_EMPTY_COMPONENT_NAME = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'nz-empty-component-name' : ''); /** * 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 */ class NzEmptyDefaultComponent { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: NzEmptyDefaultComponent, isStandalone: true, selector: "nz-empty-default", exportAs: ["nzEmptyDefault"], ngImport: i0, template: ` `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyDefaultComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-empty-default', exportAs: 'nzEmptyDefault', template: ` ` }] }] }); /** * 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 */ class NzEmptySimpleComponent { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptySimpleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: NzEmptySimpleComponent, isStandalone: true, selector: "nz-empty-simple", exportAs: ["nzEmptySimple"], ngImport: i0, template: ` `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptySimpleComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-empty-simple', exportAs: 'nzEmptySimple', template: ` ` }] }] }); /** * 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 */ const NzEmptyDefaultImages = ['default', 'simple']; class NzEmptyComponent { i18n = inject(NzI18nService); cdr = inject(ChangeDetectorRef); destroyRef = inject(DestroyRef); nzNotFoundImage = 'default'; nzNotFoundContent; nzNotFoundFooter; isContentString = false; isImageBuildIn = true; locale; ngOnChanges(changes) { const { nzNotFoundContent, nzNotFoundImage } = changes; if (nzNotFoundContent) { const content = nzNotFoundContent.currentValue; this.isContentString = typeof content === 'string'; } if (nzNotFoundImage) { const image = nzNotFoundImage.currentValue || 'default'; this.isImageBuildIn = NzEmptyDefaultImages.findIndex(i => i === image) > -1; } } ngOnInit() { this.i18n.localeChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => { this.locale = this.i18n.getLocaleData('Empty'); this.cdr.markForCheck(); }); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: NzEmptyComponent, isStandalone: true, selector: "nz-empty", inputs: { nzNotFoundImage: "nzNotFoundImage", nzNotFoundContent: "nzNotFoundContent", nzNotFoundFooter: "nzNotFoundFooter" }, host: { classAttribute: "ant-empty" }, exportAs: ["nzEmpty"], usesOnChanges: true, ngImport: i0, template: `
@if (!isImageBuildIn) { } @else { @if (nzNotFoundImage === 'simple') { } @else { } }
@if (nzNotFoundContent !== null) {

{{ isContentString ? nzNotFoundContent : locale['description'] }}

} @if (nzNotFoundFooter) { } `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i1.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "component", type: NzEmptyDefaultComponent, selector: "nz-empty-default", exportAs: ["nzEmptyDefault"] }, { kind: "component", type: NzEmptySimpleComponent, selector: "nz-empty-simple", exportAs: ["nzEmptySimple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-empty', exportAs: 'nzEmpty', template: `
@if (!isImageBuildIn) { } @else { @if (nzNotFoundImage === 'simple') { } @else { } }
@if (nzNotFoundContent !== null) {

{{ isContentString ? nzNotFoundContent : locale['description'] }}

} @if (nzNotFoundFooter) { } `, host: { class: 'ant-empty' }, imports: [NzOutletModule, NzEmptyDefaultComponent, NzEmptySimpleComponent] }] }], propDecorators: { nzNotFoundImage: [{ type: Input }], nzNotFoundContent: [{ type: Input }], nzNotFoundFooter: [{ type: Input }] } }); /** * 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 */ function getEmptySize(componentName) { switch (componentName) { case 'table': case 'list': return 'normal'; case 'select': case 'tree-select': case 'cascader': case 'transfer': return 'small'; default: return ''; } } class NzEmbedEmptyComponent { configService = inject(NzConfigService); viewContainerRef = inject(ViewContainerRef); cdr = inject(ChangeDetectorRef); injector = inject(Injector); nzComponentName; specificContent; content; contentType = 'string'; contentPortal; size = ''; constructor() { onConfigChangeEventForComponent('empty', () => { this.content = this.specificContent || this.getUserDefaultEmptyContent(); this.renderEmpty(); }); } ngOnChanges(changes) { if (changes.nzComponentName) { this.size = getEmptySize(changes.nzComponentName.currentValue); } if (changes.specificContent && !changes.specificContent.isFirstChange()) { this.content = changes.specificContent.currentValue; this.renderEmpty(); } } ngOnInit() { this.content = this.specificContent || this.getUserDefaultEmptyContent(); this.renderEmpty(); } renderEmpty() { const content = this.content; if (typeof content === 'string') { this.contentType = 'string'; } else if (content instanceof TemplateRef) { this.contentType = 'template'; this.contentPortal = undefined; } else if (content instanceof Type) { const injector = Injector.create({ parent: this.injector, providers: [{ provide: NZ_EMPTY_COMPONENT_NAME, useValue: this.nzComponentName }] }); this.contentType = 'component'; this.contentPortal = new ComponentPortal(content, this.viewContainerRef, injector); } else { this.contentType = 'string'; this.contentPortal = undefined; } this.cdr.detectChanges(); } getUserDefaultEmptyContent() { return (this.configService.getConfigForComponent('empty') || {}).nzDefaultEmptyContent; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmbedEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: NzEmbedEmptyComponent, isStandalone: true, selector: "nz-embed-empty", inputs: { nzComponentName: "nzComponentName", specificContent: "specificContent" }, exportAs: ["nzEmbedEmpty"], usesOnChanges: true, ngImport: i0, template: ` @if (content) { @if (contentType === 'template' || contentType === 'string') { {{ content }} } @else { } } @else { @if (specificContent !== null) { @switch (size) { @case ('normal') { } @case ('small') { } @default { } } } } `, isInline: true, dependencies: [{ kind: "component", type: NzEmptyComponent, selector: "nz-empty", inputs: ["nzNotFoundImage", "nzNotFoundContent", "nzNotFoundFooter"], exportAs: ["nzEmpty"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i1.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmbedEmptyComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-embed-empty', exportAs: 'nzEmbedEmpty', template: ` @if (content) { @if (contentType === 'template' || contentType === 'string') { {{ content }} } @else { } } @else { @if (specificContent !== null) { @switch (size) { @case ('normal') { } @case ('small') { } @default { } } } } `, imports: [NzEmptyComponent, PortalModule, NzOutletModule] }] }], ctorParameters: () => [], propDecorators: { nzComponentName: [{ type: Input }], specificContent: [{ type: Input }] } }); /** * 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 */ class NzEmptyModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyModule, imports: [NzEmptyComponent, NzEmbedEmptyComponent, NzEmptyDefaultComponent, NzEmptySimpleComponent], exports: [NzEmptyComponent, NzEmbedEmptyComponent] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyModule, imports: [NzEmptyComponent, NzEmbedEmptyComponent] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzEmptyModule, decorators: [{ type: NgModule, args: [{ imports: [NzEmptyComponent, NzEmbedEmptyComponent, NzEmptyDefaultComponent, NzEmptySimpleComponent], exports: [NzEmptyComponent, NzEmbedEmptyComponent] }] }] }); /** * 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 */ /** * Generated bundle index. Do not edit. */ export { NZ_EMPTY_COMPONENT_NAME, NzEmbedEmptyComponent, NzEmptyComponent, NzEmptyDefaultComponent, NzEmptyModule, NzEmptySimpleComponent }; //# sourceMappingURL=ng-zorro-antd-empty.mjs.map