import * as i2$1 from '@angular/cdk/portal';
import { TemplatePortal, ComponentPortal, PortalModule } from '@angular/cdk/portal';
import * as i0 from '@angular/core';
import { InjectionToken, ViewEncapsulation, ChangeDetectionStrategy, Component, Input, TemplateRef, Type, Injector, NgModule } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil, startWith } from 'rxjs/operators';
import * as i2 from 'ng-zorro-antd/core/outlet';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import * as i1 from 'ng-zorro-antd/i18n';
import * as i1$1 from 'ng-zorro-antd/core/config';
/**
* 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('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: "19.2.2", ngImport: i0, type: NzEmptyDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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: "19.2.2", 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: "19.2.2", ngImport: i0, type: NzEmptySimpleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", 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: "19.2.2", 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;
cdr;
nzNotFoundImage = 'default';
nzNotFoundContent;
nzNotFoundFooter;
isContentString = false;
isImageBuildIn = true;
locale;
destroy$ = new Subject();
constructor(i18n, cdr) {
this.i18n = i18n;
this.cdr = cdr;
}
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(takeUntil(this.destroy$)).subscribe(() => {
this.locale = this.i18n.getLocaleData('Empty');
this.cdr.markForCheck();
});
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzEmptyComponent, deps: [{ token: i1.NzI18nService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", 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: i2.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: "19.2.2", 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]
}]
}], ctorParameters: () => [{ type: i1.NzI18nService }, { type: i0.ChangeDetectorRef }], 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;
viewContainerRef;
cdr;
injector;
nzComponentName;
specificContent;
content;
contentType = 'string';
contentPortal;
size = '';
destroy$ = new Subject();
constructor(configService, viewContainerRef, cdr, injector) {
this.configService = configService;
this.viewContainerRef = viewContainerRef;
this.cdr = cdr;
this.injector = injector;
}
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.subscribeDefaultEmptyContentChange();
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
renderEmpty() {
const content = this.content;
if (typeof content === 'string') {
this.contentType = 'string';
}
else if (content instanceof TemplateRef) {
const context = { $implicit: this.nzComponentName };
this.contentType = 'template';
this.contentPortal = new TemplatePortal(content, this.viewContainerRef, context);
}
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();
}
subscribeDefaultEmptyContentChange() {
this.configService
.getConfigChangeEventForComponent('empty')
.pipe(startWith(true), takeUntil(this.destroy$))
.subscribe(() => {
this.content = this.specificContent || this.getUserDefaultEmptyContent();
this.renderEmpty();
});
}
getUserDefaultEmptyContent() {
return (this.configService.getConfigForComponent('empty') || {}).nzDefaultEmptyContent;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzEmbedEmptyComponent, deps: [{ token: i1$1.NzConfigService }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzEmbedEmptyComponent, isStandalone: true, selector: "nz-embed-empty", inputs: { nzComponentName: "nzComponentName", specificContent: "specificContent" }, exportAs: ["nzEmbedEmpty"], usesOnChanges: true, ngImport: i0, template: `
@if (content) {
@if (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: i2$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", 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 === 'string') {
{{ content }}
} @else {
}
} @else {
@if (specificContent !== null) {
@switch (size) {
@case ('normal') {
}
@case ('small') {
}
@default {
}
}
}
}
`,
imports: [NzEmptyComponent, PortalModule]
}]
}], ctorParameters: () => [{ type: i1$1.NzConfigService }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }], 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: "19.2.2", ngImport: i0, type: NzEmptyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzEmptyModule, imports: [NzEmptyComponent, NzEmbedEmptyComponent, NzEmptyDefaultComponent, NzEmptySimpleComponent], exports: [NzEmptyComponent, NzEmbedEmptyComponent] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzEmptyModule, imports: [NzEmptyComponent, NzEmbedEmptyComponent] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", 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