import { NzDropDownDirective, NzDropDownModule } from "./chunk-6YSLOGDV.js"; import "./chunk-N2PB3IXS.js"; import "./chunk-XNSEPSHF.js"; import { ActivatedRoute, NavigationEnd, PRIMARY_OUTLET, Router } from "./chunk-OHFVGNRL.js"; import "./chunk-BGVPPB2M.js"; import "./chunk-RKDI7MDU.js"; import "./chunk-YFXR6SLR.js"; import "./chunk-HF5YUKES.js"; import { NzOutletModule, NzStringTemplateOutletDirective } from "./chunk-II6F7O4R.js"; import "./chunk-I4PM4FPC.js"; import { NzIconDirective, NzIconModule } from "./chunk-LE6DQ524.js"; import "./chunk-JGP5BR6B.js"; import "./chunk-R3YQA6NO.js"; import "./chunk-KBVCKJGB.js"; import { Directionality } from "./chunk-XJ6U6HBE.js"; import "./chunk-MQMU2B2N.js"; import { InputBoolean, PREFIX } from "./chunk-JXVDBMEG.js"; import "./chunk-DLJPVZ6P.js"; import "./chunk-EIAJJHP2.js"; import "./chunk-Q3CVYH5T.js"; import "./chunk-U3HDGNZW.js"; import { NgForOf, NgIf, NgTemplateOutlet } from "./chunk-GRUKGTMG.js"; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Injector, Input, NgModule, Optional, Renderer2, ViewEncapsulation$1, setClassMetadata, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵdefineComponent, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdirectiveInject, ɵɵelement, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵgetCurrentView, ɵɵlistener, ɵɵnextContext, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵreference, ɵɵresetView, ɵɵrestoreView, ɵɵsanitizeUrl, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1 } from "./chunk-A6CRNF4U.js"; import { Subject, __decorate, filter, startWith, takeUntil } from "./chunk-ZAWZRDJR.js"; import "./chunk-HSNDBVJ3.js"; // node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-breadcrumb.mjs var _c0 = ["*"]; function NzBreadCrumbItemComponent_ng_container_0_ng_template_2_Template(rf, ctx) { } function NzBreadCrumbItemComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) { ɵɵelementContainerStart(0); ɵɵelementStart(1, "span", 3); ɵɵtemplate(2, NzBreadCrumbItemComponent_ng_container_0_ng_template_2_Template, 0, 0, "ng-template", 4); ɵɵelement(3, "span", 5); ɵɵelementEnd(); ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r0 = ɵɵnextContext(); const _r2 = ɵɵreference(2); ɵɵadvance(1); ɵɵproperty("nzDropdownMenu", ctx_r0.nzOverlay); ɵɵadvance(1); ɵɵproperty("ngTemplateOutlet", _r2); } } function NzBreadCrumbItemComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) { ɵɵelementStart(0, "span", 6); ɵɵprojection(1); ɵɵelementEnd(); } } function NzBreadCrumbItemComponent_nz_breadcrumb_separator_3_ng_container_1_Template(rf, ctx) { if (rf & 1) { ɵɵelementContainerStart(0); ɵɵtext(1); ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r5 = ɵɵnextContext(2); ɵɵadvance(1); ɵɵtextInterpolate1(" ", ctx_r5.nzBreadCrumbComponent.nzSeparator, " "); } } function NzBreadCrumbItemComponent_nz_breadcrumb_separator_3_Template(rf, ctx) { if (rf & 1) { ɵɵelementStart(0, "nz-breadcrumb-separator"); ɵɵtemplate(1, NzBreadCrumbItemComponent_nz_breadcrumb_separator_3_ng_container_1_Template, 2, 1, "ng-container", 7); ɵɵelementEnd(); } if (rf & 2) { const ctx_r3 = ɵɵnextContext(); ɵɵadvance(1); ɵɵproperty("nzStringTemplateOutlet", ctx_r3.nzBreadCrumbComponent.nzSeparator); } } function NzBreadCrumbComponent_ng_container_1_nz_breadcrumb_item_1_Template(rf, ctx) { if (rf & 1) { const _r4 = ɵɵgetCurrentView(); ɵɵelementStart(0, "nz-breadcrumb-item")(1, "a", 2); ɵɵlistener("click", function NzBreadCrumbComponent_ng_container_1_nz_breadcrumb_item_1_Template_a_click_1_listener($event) { const restoredCtx = ɵɵrestoreView(_r4); const breadcrumb_r2 = restoredCtx.$implicit; const ctx_r3 = ɵɵnextContext(2); return ɵɵresetView(ctx_r3.navigate(breadcrumb_r2.url, $event)); }); ɵɵtext(2); ɵɵelementEnd()(); } if (rf & 2) { const breadcrumb_r2 = ctx.$implicit; ɵɵadvance(1); ɵɵattribute("href", breadcrumb_r2.url, ɵɵsanitizeUrl); ɵɵadvance(1); ɵɵtextInterpolate(breadcrumb_r2.label); } } function NzBreadCrumbComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) { ɵɵelementContainerStart(0); ɵɵtemplate(1, NzBreadCrumbComponent_ng_container_1_nz_breadcrumb_item_1_Template, 3, 2, "nz-breadcrumb-item", 1); ɵɵelementContainerEnd(); } if (rf & 2) { const ctx_r0 = ɵɵnextContext(); ɵɵadvance(1); ɵɵproperty("ngForOf", ctx_r0.breadcrumbs); } } var _NzBreadCrumbSeparatorComponent = class _NzBreadCrumbSeparatorComponent { }; _NzBreadCrumbSeparatorComponent.ɵfac = function NzBreadCrumbSeparatorComponent_Factory(t) { return new (t || _NzBreadCrumbSeparatorComponent)(); }; _NzBreadCrumbSeparatorComponent.ɵcmp = ɵɵdefineComponent({ type: _NzBreadCrumbSeparatorComponent, selectors: [["nz-breadcrumb-separator"]], hostAttrs: [1, "ant-breadcrumb-separator"], exportAs: ["nzBreadcrumbSeparator"], standalone: true, features: [ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 1, vars: 0, template: function NzBreadCrumbSeparatorComponent_Template(rf, ctx) { if (rf & 1) { ɵɵprojectionDef(); ɵɵprojection(0); } }, encapsulation: 2 }); var NzBreadCrumbSeparatorComponent = _NzBreadCrumbSeparatorComponent; (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzBreadCrumbSeparatorComponent, [{ type: Component, args: [{ selector: "nz-breadcrumb-separator", exportAs: "nzBreadcrumbSeparator", standalone: true, template: ``, host: { class: "ant-breadcrumb-separator" } }] }], null, null); })(); var NzBreadcrumb = class { }; var _NzBreadCrumbItemComponent = class _NzBreadCrumbItemComponent { constructor(nzBreadCrumbComponent) { this.nzBreadCrumbComponent = nzBreadCrumbComponent; } }; _NzBreadCrumbItemComponent.ɵfac = function NzBreadCrumbItemComponent_Factory(t) { return new (t || _NzBreadCrumbItemComponent)(ɵɵdirectiveInject(NzBreadcrumb)); }; _NzBreadCrumbItemComponent.ɵcmp = ɵɵdefineComponent({ type: _NzBreadCrumbItemComponent, selectors: [["nz-breadcrumb-item"]], inputs: { nzOverlay: "nzOverlay" }, exportAs: ["nzBreadcrumbItem"], standalone: true, features: [ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 4, vars: 3, consts: [[4, "ngIf", "ngIfElse"], ["noMenuTpl", ""], [4, "ngIf"], ["nz-dropdown", "", 1, "ant-breadcrumb-overlay-link", 3, "nzDropdownMenu"], [3, "ngTemplateOutlet"], ["nz-icon", "", "nzType", "down"], [1, "ant-breadcrumb-link"], [4, "nzStringTemplateOutlet"]], template: function NzBreadCrumbItemComponent_Template(rf, ctx) { if (rf & 1) { ɵɵprojectionDef(); ɵɵtemplate(0, NzBreadCrumbItemComponent_ng_container_0_Template, 4, 2, "ng-container", 0)(1, NzBreadCrumbItemComponent_ng_template_1_Template, 2, 0, "ng-template", null, 1, ɵɵtemplateRefExtractor)(3, NzBreadCrumbItemComponent_nz_breadcrumb_separator_3_Template, 2, 1, "nz-breadcrumb-separator", 2); } if (rf & 2) { const _r2 = ɵɵreference(2); ɵɵproperty("ngIf", !!ctx.nzOverlay)("ngIfElse", _r2); ɵɵadvance(3); ɵɵproperty("ngIf", ctx.nzBreadCrumbComponent.nzSeparator); } }, dependencies: [NgIf, NgTemplateOutlet, NzBreadCrumbSeparatorComponent, NzDropDownModule, NzDropDownDirective, NzIconModule, NzIconDirective, NzOutletModule, NzStringTemplateOutletDirective], encapsulation: 2, changeDetection: 0 }); var NzBreadCrumbItemComponent = _NzBreadCrumbItemComponent; (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzBreadCrumbItemComponent, [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation$1.None, selector: "nz-breadcrumb-item", exportAs: "nzBreadcrumbItem", preserveWhitespaces: false, standalone: true, imports: [NgIf, NgTemplateOutlet, NzBreadCrumbSeparatorComponent, NzDropDownModule, NzIconModule, NzOutletModule], template: ` {{ nzBreadCrumbComponent.nzSeparator }} ` }] }], () => [{ type: NzBreadcrumb }], { nzOverlay: [{ type: Input }] }); })(); var _NzBreadCrumbComponent = class _NzBreadCrumbComponent { constructor(injector, cdr, elementRef, renderer, directionality) { this.injector = injector; this.cdr = cdr; this.elementRef = elementRef; this.renderer = renderer; this.directionality = directionality; this.nzAutoGenerate = false; this.nzSeparator = "/"; this.nzRouteLabel = "breadcrumb"; this.nzRouteLabelFn = (label) => label; this.breadcrumbs = []; this.dir = "ltr"; this.destroy$ = new Subject(); } ngOnInit() { if (this.nzAutoGenerate) { this.registerRouterChange(); } this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => { this.dir = direction; this.prepareComponentForRtl(); this.cdr.detectChanges(); }); this.dir = this.directionality.value; this.prepareComponentForRtl(); } ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } navigate(url, e) { e.preventDefault(); this.injector.get(Router).navigateByUrl(url); } registerRouterChange() { try { const router = this.injector.get(Router); const activatedRoute = this.injector.get(ActivatedRoute); router.events.pipe( filter((e) => e instanceof NavigationEnd), takeUntil(this.destroy$), startWith(true) // trigger initial render ).subscribe(() => { this.breadcrumbs = this.getBreadcrumbs(activatedRoute.root); this.cdr.markForCheck(); }); } catch (e) { throw new Error(`${PREFIX} You should import RouterModule if you want to use 'NzAutoGenerate'.`); } } getBreadcrumbs(route, url = "", breadcrumbs = []) { const children = route.children; if (children.length === 0) { return breadcrumbs; } for (const child of children) { if (child.outlet === PRIMARY_OUTLET) { const routeUrl = child.snapshot.url.map((segment) => segment.path).filter((path) => path).join("/"); const nextUrl = routeUrl ? `${url}/${routeUrl}` : url; const breadcrumbLabel = this.nzRouteLabelFn(child.snapshot.data[this.nzRouteLabel]); if (routeUrl && breadcrumbLabel) { const breadcrumb = { label: breadcrumbLabel, params: child.snapshot.params, url: nextUrl }; breadcrumbs.push(breadcrumb); } return this.getBreadcrumbs(child, nextUrl, breadcrumbs); } } return breadcrumbs; } prepareComponentForRtl() { if (this.dir === "rtl") { this.renderer.addClass(this.elementRef.nativeElement, "ant-breadcrumb-rtl"); } else { this.renderer.removeClass(this.elementRef.nativeElement, "ant-breadcrumb-rtl"); } } }; _NzBreadCrumbComponent.ɵfac = function NzBreadCrumbComponent_Factory(t) { return new (t || _NzBreadCrumbComponent)(ɵɵdirectiveInject(Injector), ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(Directionality, 8)); }; _NzBreadCrumbComponent.ɵcmp = ɵɵdefineComponent({ type: _NzBreadCrumbComponent, selectors: [["nz-breadcrumb"]], hostAttrs: [1, "ant-breadcrumb"], inputs: { nzAutoGenerate: "nzAutoGenerate", nzSeparator: "nzSeparator", nzRouteLabel: "nzRouteLabel", nzRouteLabelFn: "nzRouteLabelFn" }, exportAs: ["nzBreadcrumb"], standalone: true, features: [ɵɵProvidersFeature([{ provide: NzBreadcrumb, useExisting: _NzBreadCrumbComponent }]), ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 2, vars: 1, consts: [[4, "ngIf"], [4, "ngFor", "ngForOf"], [3, "click"]], template: function NzBreadCrumbComponent_Template(rf, ctx) { if (rf & 1) { ɵɵprojectionDef(); ɵɵprojection(0); ɵɵtemplate(1, NzBreadCrumbComponent_ng_container_1_Template, 2, 1, "ng-container", 0); } if (rf & 2) { ɵɵadvance(1); ɵɵproperty("ngIf", ctx.nzAutoGenerate && ctx.breadcrumbs.length); } }, dependencies: [NgForOf, NgIf, NzBreadCrumbItemComponent], encapsulation: 2, changeDetection: 0 }); var NzBreadCrumbComponent = _NzBreadCrumbComponent; __decorate([InputBoolean()], NzBreadCrumbComponent.prototype, "nzAutoGenerate", void 0); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzBreadCrumbComponent, [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation$1.None, selector: "nz-breadcrumb", exportAs: "nzBreadcrumb", preserveWhitespaces: false, providers: [{ provide: NzBreadcrumb, useExisting: NzBreadCrumbComponent }], standalone: true, imports: [NgForOf, NgIf, NzBreadCrumbItemComponent], template: ` {{ breadcrumb.label }} `, host: { class: "ant-breadcrumb" } }] }], () => [{ type: Injector }, { type: ChangeDetectorRef }, { type: ElementRef }, { type: Renderer2 }, { type: Directionality, decorators: [{ type: Optional }] }], { nzAutoGenerate: [{ type: Input }], nzSeparator: [{ type: Input }], nzRouteLabel: [{ type: Input }], nzRouteLabelFn: [{ type: Input }] }); })(); var _NzBreadCrumbModule = class _NzBreadCrumbModule { }; _NzBreadCrumbModule.ɵfac = function NzBreadCrumbModule_Factory(t) { return new (t || _NzBreadCrumbModule)(); }; _NzBreadCrumbModule.ɵmod = ɵɵdefineNgModule({ type: _NzBreadCrumbModule, imports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent], exports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent] }); _NzBreadCrumbModule.ɵinj = ɵɵdefineInjector({ imports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent] }); var NzBreadCrumbModule = _NzBreadCrumbModule; (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzBreadCrumbModule, [{ type: NgModule, args: [{ imports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent], exports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent] }] }], null, null); })(); export { NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbModule, NzBreadCrumbSeparatorComponent }; //# sourceMappingURL=ng-zorro-antd_breadcrumb.js.map