ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2,317 lines • 76.7 kB
JavaScript
import { __esDecorate, __runInitializers } from "tslib";
import { Directionality } from "@angular/cdk/bidi";
import { BACKSPACE, DOWN_ARROW, ENTER, ESCAPE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW } from "@angular/cdk/keycodes";
import * as i2 from "@angular/cdk/overlay";
import { CdkConnectedOverlay, OverlayModule } from "@angular/cdk/overlay";
import { _getEventTarget } from "@angular/cdk/platform";
import { NgTemplateOutlet, SlicePipe } from "@angular/common";
import * as i0 from "@angular/core";
import { ChangeDetectorRef, Component, DestroyRef, ElementRef, EventEmitter, Injectable, Input, NgModule, NgZone, Output, Pipe, Renderer2, ViewChild, ViewChildren, ViewEncapsulation, booleanAttribute, computed, forwardRef, inject, numberAttribute, output, signal } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { FormsModule, NG_VALUE_ACCESSOR } from "@angular/forms";
import { BehaviorSubject, Subject, merge } from "rxjs";
import { distinctUntilChanged, finalize, startWith, switchMap } from "rxjs/operators";
import { NzNoAnimationDirective, slideAnimationEnter, slideAnimationLeave } from "ng-zorro-antd/core/animation";
import { WithConfig, onConfigChangeEventForComponent } from "ng-zorro-antd/core/config";
import { NZ_FORM_SIZE, NZ_FORM_VARIANT, NzFormItemFeedbackIconComponent, NzFormStatusService } from "ng-zorro-antd/core/form";
import * as i2$1 from "ng-zorro-antd/core/outlet";
import { NzOutletModule, NzStringTemplateOutletDirective } from "ng-zorro-antd/core/outlet";
import * as i5 from "ng-zorro-antd/core/overlay";
import { DEFAULT_CASCADER_POSITIONS, NzOverlayModule, POSITION_MAP, getPlacementName } from "ng-zorro-antd/core/overlay";
import { NzTreeBase, NzTreeBaseService, NzTreeNode } from "ng-zorro-antd/core/tree";
import { arraysEqual, fromEventOutsideAngular, getStatusClassNames, isNotNil, toArray, wrapIntoObservable } from "ng-zorro-antd/core/util";
import * as i4 from "ng-zorro-antd/empty";
import { NzEmptyModule } from "ng-zorro-antd/empty";
import { NzI18nService } from "ng-zorro-antd/i18n";
import * as i1$1 from "ng-zorro-antd/icon";
import { NzIconModule } from "ng-zorro-antd/icon";
import { NzSelectClearComponent, NzSelectItemComponent, NzSelectPlaceholderComponent, NzSelectSearchComponent } from "ng-zorro-antd/select";
import * as i1 from "ng-zorro-antd/space";
import { NZ_SPACE_COMPACT_ITEM_TYPE, NZ_SPACE_COMPACT_SIZE, NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
import { NzHighlightPipe } from "ng-zorro-antd/core/highlight";
function isShowSearchObject(options) {
return typeof options !== "boolean";
}
function isChildNode(node) {
return node.isLeaf || !node.children || !node.children.length;
}
function isParentNode(node) {
return !!node.children && !!node.children.length && !node.isLeaf;
}
var NzCascaderTreeService = class NzCascaderTreeService extends NzTreeBaseService {
fieldNames = {
label: "label",
value: "value"
};
treeNodePostProcessor = (node) => {
node.key = this.getOptionValue(node);
node.title = this.getOptionLabel(node);
};
getOptionValue(node) {
return node.origin[this.fieldNames.value || "value"];
}
getOptionLabel(node) {
return node.origin[this.fieldNames.label || "label"];
}
get children() {
return this.rootNodes;
}
set children(value) {
this.rootNodes = value.map((v) => v instanceof NzTreeNode ? v : new NzTreeNode(v, null));
}
toOptions(nodes) {
return nodes.map((node) => node.origin);
}
getAncestorNodeList(node) {
if (!node) return [];
if (node.parentNode) return [...this.getAncestorNodeList(node.parentNode), node];
return [node];
}
conductCheckPaths(paths, checkStrictly) {
this.checkedNodeList = [];
this.halfCheckedNodeList = [];
const existsPathList = [];
const calc = (nodes) => {
nodes.forEach((node) => {
if (paths === null) node.isChecked = !!node.origin.checked;
else {
const nodePath = this.getAncestorNodeList(node).map((n) => this.getOptionValue(n));
if (paths.some((keys) => arraysEqual(nodePath, keys))) {
node.isChecked = true;
node.isHalfChecked = false;
existsPathList.push(nodePath);
} else {
node.isChecked = false;
node.isHalfChecked = false;
}
}
if (node.children.length > 0) calc(node.children);
});
};
calc(this.rootNodes);
this.refreshCheckState(checkStrictly);
this.handleMissingNodeList(paths, existsPathList);
}
conductSelectedPaths(paths) {
this.selectedNodeList.forEach((node) => node.isSelected = false);
this.selectedNodeList = [];
const existsPathList = [];
const calc = (nodes) => nodes.every((node) => {
const nodePath = this.getAncestorNodeList(node).map((n) => this.getOptionValue(n));
if (paths.some((keys) => arraysEqual(nodePath, keys))) {
node.isSelected = true;
this.setSelectedNodeList(node);
existsPathList.push(nodePath);
return false;
} else node.isSelected = false;
if (node.children.length > 0) return calc(node.children);
return true;
});
calc(this.rootNodes);
this.handleMissingNodeList(paths, existsPathList);
}
handleMissingNodeList(paths, existsPathList) {
this.getMissingNodeList(paths, existsPathList).forEach((node) => {
this.setSelectedNodeList(node);
});
}
getMissingNodeList(paths, existsPathList) {
if (!paths) return [];
return paths.filter((path) => !existsPathList.some((keys) => arraysEqual(path, keys))).map((path) => this.createMissingNode(path)).filter(isNotNil);
}
createMissingNode(path) {
if (!path?.length) return null;
const createOption = (key) => {
return {
[this.fieldNames.value || "value"]: key,
[this.fieldNames.label || "label"]: key
};
};
let node = new NzTreeNode(createOption(path[0]), null, this);
for (let i = 1; i < path.length; i++) {
const childNode = new NzTreeNode(createOption(path[i]));
node.addChildren([childNode]);
node = childNode;
}
if (this.isMultiple) {
node.isChecked = true;
node.isHalfChecked = false;
} else node.isSelected = true;
return node;
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderTreeService,
deps: null,
target: i0.ɵɵFactoryTarget.Injectable
});
static ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderTreeService
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderTreeService,
decorators: [{ type: Injectable }]
});
var NzCascaderService = class NzCascaderService {
destroyRef = inject(DestroyRef);
activatedNodes = [];
columns = [];
inSearchingMode = false;
values = [];
$loading = new BehaviorSubject(false);
$redraw = new Subject();
$nodeSelected = new Subject();
$quitSearching = new Subject();
columnSnapshot = [[]];
cascaderComponent;
searchOptionPathMap = /* @__PURE__ */ new Map();
constructor() {
this.destroyRef.onDestroy(() => {
this.$redraw.complete();
this.$quitSearching.complete();
this.$nodeSelected.complete();
this.$loading.complete();
this.searchOptionPathMap.clear();
});
}
get nzOptions() {
return this.cascaderComponent.treeService.toOptions(this.columns[0] || []);
}
withComponent(cascaderComponent) {
this.cascaderComponent = cascaderComponent;
}
setNodeActivated(node, columnIndex, performSelect = false, multiple = false, loadingChildren = true) {
if (node.isDisabled) return;
this.activatedNodes[columnIndex] = node;
this.trackAncestorActivatedNodes(columnIndex);
this.dropBehindActivatedNodes(columnIndex);
if (isParentNode(node)) this.setColumnData(node.children, columnIndex + 1);
else if (!node.isLeaf && loadingChildren) this.loadChildren(node, columnIndex);
else if (node.isLeaf) this.dropBehindColumns(columnIndex);
if (performSelect && node.isSelectable) this.setNodeSelected(node, columnIndex, multiple);
this.$redraw.next();
}
setNodeSelected(node, index, multiple = false) {
const changeOn = this.cascaderComponent.nzChangeOn;
const shouldPerformSelection = (o, i) => typeof changeOn === "function" ? changeOn(o, i) : false;
if (multiple || node.isLeaf || this.cascaderComponent.nzChangeOnSelect || shouldPerformSelection(node.origin, index)) {
node.isSelected = true;
this.cascaderComponent.treeService.setSelectedNodeList(node, multiple);
this.cascaderComponent.updateSelectedNodes();
this.$redraw.next();
this.$nodeSelected.next(node);
}
}
setNodeDeactivatedSinceColumn(column) {
this.dropBehindActivatedNodes(column - 1);
this.dropBehindColumns(column);
this.$redraw.next();
}
setSearchOptionSelected(node, multiple = false) {
this.setNodeSelected(node, node.level, multiple);
setTimeout(() => {
this.$quitSearching.next();
this.$redraw.next();
}, 200);
}
clearSearchOptions() {
for (const node of this.searchOptionPathMap.keys()) {
node.isDisabled = node.origin.disabled || false;
node.title = this.getOptionLabel(node.origin);
}
this.searchOptionPathMap.clear();
}
prepareSearchOptions(searchValue) {
const results = [];
const path = [];
const defaultFilter = (i, p) => p.some((o) => {
const label = this.getOptionLabel(o);
return !!label && label.indexOf(i) !== -1;
});
const showSearch = this.cascaderComponent.nzShowSearch;
const filter = isShowSearchObject(showSearch) && showSearch.filter ? showSearch.filter : defaultFilter;
const sorter = isShowSearchObject(showSearch) && showSearch.sorter ? showSearch.sorter : null;
const loopChild = (node, forceDisabled = false) => {
path.push(node);
const cPath = this.cascaderComponent.treeService.toOptions(path);
if (filter(searchValue, cPath)) {
this.searchOptionPathMap.set(node, cPath);
node.isDisabled = forceDisabled || node.isDisabled;
node.title = cPath.map((p) => this.getOptionLabel(p)).join(" / ");
results.push(node);
}
path.pop();
};
const loopParent = (node, forceDisabled = false) => {
const disabled = forceDisabled || node.isDisabled;
path.push(node);
node.children.forEach((sNode) => {
if (!sNode.isLeaf) loopParent(sNode, disabled);
if (sNode.isLeaf || !sNode.children || !sNode.children.length) loopChild(sNode, disabled);
});
path.pop();
};
if (!this.columnSnapshot.length) {
this.columns = [[]];
return;
}
this.columnSnapshot[0].forEach((o) => isChildNode(o) ? loopChild(o) : loopParent(o));
if (sorter) results.sort((a, b) => sorter(this.searchOptionPathMap.get(a), this.searchOptionPathMap.get(b), searchValue));
this.columns = [results];
this.$redraw.next();
}
setSearchingMode(toSearching) {
this.inSearchingMode = toSearching;
if (toSearching) {
this.clearSearchOptions();
this.columnSnapshot = [...this.columns];
this.activatedNodes = [];
} else {
this.clearSearchOptions();
this.activatedNodes = [];
setTimeout(() => {
this.columns = [...this.columnSnapshot];
if (this.cascaderComponent.selectedNodes.length) {
const activatedNode = this.cascaderComponent.selectedNodes[0];
const columnIndex = activatedNode.level;
this.activatedNodes[columnIndex] = activatedNode;
this.trackAncestorActivatedNodes(columnIndex);
this.trackAncestorColumnData(columnIndex);
}
this.$redraw.next();
});
}
this.$redraw.next();
}
clear() {
this.values = [];
this.activatedNodes = [];
this.dropBehindColumns(0);
this.$redraw.next();
this.$nodeSelected.next(null);
}
getOptionLabel(o) {
return o[this.cascaderComponent.nzLabelProperty || "label"];
}
getOptionValue(o) {
return o[this.cascaderComponent.nzValueProperty || "value"];
}
setColumnData(nodes, columnIndex) {
this.columns[columnIndex] = nodes;
this.dropBehindColumns(columnIndex);
}
trackAncestorColumnData(startIndex) {
if (!this.activatedNodes[startIndex]) return;
this.dropBehindColumns(startIndex);
for (let i = 0; i < startIndex; i++) this.columns[i + 1] = this.activatedNodes[i].children;
}
trackAncestorActivatedNodes(startIndex) {
for (let i = startIndex - 1; i >= 0; i--) if (!this.activatedNodes[i]) this.activatedNodes[i] = this.activatedNodes[i + 1].parentNode;
}
dropBehindActivatedNodes(lastReserveIndex) {
this.activatedNodes = this.activatedNodes.splice(0, lastReserveIndex + 1);
}
dropBehindColumns(lastReserveIndex) {
if (lastReserveIndex < this.columns.length - 1) this.columns = this.columns.slice(0, lastReserveIndex + 1);
}
loadChildren(node, columnIndex, onLoaded) {
const isRoot = columnIndex < 0 || !isNotNil(node);
const option = node?.origin || {};
const loadFn = this.cascaderComponent.nzLoadData;
if (loadFn) {
this.$loading.next(isRoot);
if (node) node.isLoading = true;
wrapIntoObservable(loadFn(option, columnIndex)).pipe(finalize(() => {
node && (node.isLoading = false);
this.$loading.next(false);
this.$redraw.next();
})).subscribe({
next: () => {
if (option.children) {
if (!isRoot) {
const nodes = option.children.map((o) => new NzTreeNode(o, node));
node.children = nodes;
this.setColumnData(nodes, columnIndex + 1);
} else {
const nodes = this.cascaderComponent.coerceTreeNodes(option.children);
this.cascaderComponent.treeService.initTree(nodes);
this.setColumnData(nodes, 0);
}
onLoaded?.(option.children);
}
},
error: () => {
node && (node.isLeaf = true);
}
});
}
}
isLoaded(index) {
return !!this.columns[index] && this.columns[index].length > 0;
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderService,
deps: [],
target: i0.ɵɵFactoryTarget.Injectable
});
static ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderService
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderService,
decorators: [{ type: Injectable }],
ctorParameters: () => []
});
const defaultDisplayRender = (labels) => labels.join(" / ");
var NzDisplayRenderPipe = class NzDisplayRenderPipe {
cascaderService = inject(NzCascaderService);
cascaderTreeService = inject(NzCascaderTreeService);
transform(node) {
const ancestors = this.cascaderTreeService.getAncestorNodeList(node);
const labels = this.cascaderTreeService.toOptions(ancestors).map((o) => this.cascaderService.getOptionLabel(o));
return defaultDisplayRender(labels);
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderPipe,
deps: [],
target: i0.ɵɵFactoryTarget.Pipe
});
static ɵpipe = i0.ɵɵngDeclarePipe({
minVersion: "14.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderPipe,
isStandalone: true,
name: "nzDisplayRender"
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderPipe,
decorators: [{
type: Pipe,
args: [{ name: "nzDisplayRender" }]
}]
});
var NzDisplayRenderContextPipe = class NzDisplayRenderContextPipe {
cascaderService = inject(NzCascaderService);
cascaderTreeService = inject(NzCascaderTreeService);
transform(node) {
const ancestors = this.cascaderTreeService.getAncestorNodeList(node);
const selectedOptions = this.cascaderTreeService.toOptions(ancestors);
return {
labels: selectedOptions.map((o) => this.cascaderService.getOptionLabel(o)),
selectedOptions
};
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderContextPipe,
deps: [],
target: i0.ɵɵFactoryTarget.Pipe
});
static ɵpipe = i0.ɵɵngDeclarePipe({
minVersion: "14.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderContextPipe,
isStandalone: true,
name: "nzDisplayRenderContext"
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzDisplayRenderContextPipe,
decorators: [{
type: Pipe,
args: [{ name: "nzDisplayRenderContext" }]
}]
});
var NzCascaderOptionComponent = class NzCascaderOptionComponent {
cdr = inject(ChangeDetectorRef);
optionTemplate = null;
node;
activated = false;
highlightText;
nzLabelProperty = "label";
columnIndex;
expandIcon = "";
dir = "ltr";
checkable = false;
check = new EventEmitter();
nativeElement = inject(ElementRef).nativeElement;
ngOnInit() {
if (this.expandIcon === "" && this.dir === "rtl") this.expandIcon = "left";
else if (this.expandIcon === "") this.expandIcon = "right";
}
get checked() {
return this.node.isChecked;
}
get halfChecked() {
return this.node.isHalfChecked;
}
get disabled() {
return this.node.isDisabled || this.node.isDisableCheckbox;
}
markForCheck() {
this.cdr.markForCheck();
}
onCheckboxClick(event) {
event.preventDefault();
event.stopPropagation();
if (!this.checkable) return;
this.check.emit();
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderOptionComponent,
deps: [],
target: i0.ɵɵFactoryTarget.Component
});
static ɵcmp = i0.ɵɵngDeclareComponent({
minVersion: "17.0.0",
version: "22.2.2",
type: NzCascaderOptionComponent,
isStandalone: true,
selector: "[nz-cascader-option]",
inputs: {
optionTemplate: "optionTemplate",
node: "node",
activated: "activated",
highlightText: "highlightText",
nzLabelProperty: "nzLabelProperty",
columnIndex: [
"columnIndex",
"columnIndex",
numberAttribute
],
expandIcon: "expandIcon",
dir: "dir",
checkable: [
"checkable",
"checkable",
booleanAttribute
]
},
outputs: { check: "check" },
host: {
properties: {
"attr.title": "node.title",
"class.ant-cascader-menu-item-active": "activated",
"class.ant-cascader-menu-item-expand": "!node.isLeaf",
"class.ant-cascader-menu-item-disabled": "node.isDisabled"
},
classAttribute: "ant-cascader-menu-item ant-cascader-menu-item-expanded"
},
exportAs: ["nzCascaderOption"],
ngImport: i0,
template: `
@if (checkable) {
<span
class="ant-cascader-checkbox"
[class.ant-cascader-checkbox-checked]="checked"
[class.ant-cascader-checkbox-indeterminate]="halfChecked"
[class.ant-cascader-checkbox-disabled]="disabled"
(click)="onCheckboxClick($event)"
>
<span class="ant-cascader-checkbox-inner"></span>
</span>
}
@if (optionTemplate) {
<ng-template
[ngTemplateOutlet]="optionTemplate"
[ngTemplateOutletContext]="{ $implicit: node.origin, index: columnIndex }"
/>
} @else {
<div
class="ant-cascader-menu-item-content"
[innerHTML]="node.title | nzHighlight: highlightText : 'g' : 'ant-cascader-menu-item-keyword'"
></div>
}
@if (!node.isLeaf || node.children?.length || node.isLoading) {
<div class="ant-cascader-menu-item-expand-icon">
@if (node.isLoading) {
<nz-icon nzType="loading" />
} @else {
<ng-container *nzStringTemplateOutlet="expandIcon">
<nz-icon [nzType]="$any(expandIcon)" />
</ng-container>
}
</div>
}
`,
isInline: true,
dependencies: [
{
kind: "directive",
type: NgTemplateOutlet,
selector: "[ngTemplateOutlet]",
inputs: [
"ngTemplateOutletContext",
"ngTemplateOutlet",
"ngTemplateOutletInjector"
]
},
{
kind: "ngmodule",
type: NzIconModule
},
{
kind: "directive",
type: i1$1.NzIconDirective,
selector: "nz-icon,[nz-icon]",
inputs: [
"nzType",
"nzTheme",
"nzTwotoneColor",
"nzSpin",
"nzRotate",
"nzIconfont",
"aria-label"
],
exportAs: ["nzIcon"]
},
{
kind: "ngmodule",
type: NzOutletModule
},
{
kind: "directive",
type: i2$1.NzStringTemplateOutletDirective,
selector: "[nzStringTemplateOutlet]",
inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"],
exportAs: ["nzStringTemplateOutlet"]
},
{
kind: "pipe",
type: NzHighlightPipe,
name: "nzHighlight"
}
],
encapsulation: i0.ViewEncapsulation.None
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderOptionComponent,
decorators: [{
type: Component,
args: [{
selector: "[nz-cascader-option]",
exportAs: "nzCascaderOption",
imports: [
NgTemplateOutlet,
NzHighlightPipe,
NzIconModule,
NzOutletModule
],
template: `
@if (checkable) {
<span
class="ant-cascader-checkbox"
[class.ant-cascader-checkbox-checked]="checked"
[class.ant-cascader-checkbox-indeterminate]="halfChecked"
[class.ant-cascader-checkbox-disabled]="disabled"
(click)="onCheckboxClick($event)"
>
<span class="ant-cascader-checkbox-inner"></span>
</span>
}
@if (optionTemplate) {
<ng-template
[ngTemplateOutlet]="optionTemplate"
[ngTemplateOutletContext]="{ $implicit: node.origin, index: columnIndex }"
/>
} @else {
<div
class="ant-cascader-menu-item-content"
[innerHTML]="node.title | nzHighlight: highlightText : 'g' : 'ant-cascader-menu-item-keyword'"
></div>
}
@if (!node.isLeaf || node.children?.length || node.isLoading) {
<div class="ant-cascader-menu-item-expand-icon">
@if (node.isLoading) {
<nz-icon nzType="loading" />
} @else {
<ng-container *nzStringTemplateOutlet="expandIcon">
<nz-icon [nzType]="$any(expandIcon)" />
</ng-container>
}
</div>
}
`,
host: {
class: "ant-cascader-menu-item ant-cascader-menu-item-expanded",
"[attr.title]": "node.title",
"[class.ant-cascader-menu-item-active]": "activated",
"[class.ant-cascader-menu-item-expand]": "!node.isLeaf",
"[class.ant-cascader-menu-item-disabled]": "node.isDisabled"
},
encapsulation: ViewEncapsulation.None
}]
}],
propDecorators: {
optionTemplate: [{ type: Input }],
node: [{ type: Input }],
activated: [{ type: Input }],
highlightText: [{ type: Input }],
nzLabelProperty: [{ type: Input }],
columnIndex: [{
type: Input,
args: [{ transform: numberAttribute }]
}],
expandIcon: [{ type: Input }],
dir: [{ type: Input }],
checkable: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
check: [{ type: Output }]
}
});
const NZ_CONFIG_MODULE_NAME = "cascader";
let NzCascaderComponent = (() => {
let _classSuper = NzTreeBase;
let _nzVariant_decorators;
let _nzVariant_initializers = [];
let _nzVariant_extraInitializers = [];
let _nzSize_decorators;
let _nzSize_initializers = [];
let _nzSize_extraInitializers = [];
let _nzBackdrop_decorators;
let _nzBackdrop_initializers = [];
let _nzBackdrop_extraInitializers = [];
return class NzCascaderComponent extends _classSuper {
static {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_nzVariant_decorators = [WithConfig()];
_nzSize_decorators = [WithConfig()];
_nzBackdrop_decorators = [WithConfig()];
__esDecorate(null, null, _nzVariant_decorators, {
kind: "field",
name: "nzVariant",
static: false,
private: false,
access: {
has: (obj) => "nzVariant" in obj,
get: (obj) => obj.nzVariant,
set: (obj, value) => {
obj.nzVariant = value;
}
},
metadata: _metadata
}, _nzVariant_initializers, _nzVariant_extraInitializers);
__esDecorate(null, null, _nzSize_decorators, {
kind: "field",
name: "nzSize",
static: false,
private: false,
access: {
has: (obj) => "nzSize" in obj,
get: (obj) => obj.nzSize,
set: (obj, value) => {
obj.nzSize = value;
}
},
metadata: _metadata
}, _nzSize_initializers, _nzSize_extraInitializers);
__esDecorate(null, null, _nzBackdrop_decorators, {
kind: "field",
name: "nzBackdrop",
static: false,
private: false,
access: {
has: (obj) => "nzBackdrop" in obj,
get: (obj) => obj.nzBackdrop,
set: (obj, value) => {
obj.nzBackdrop = value;
}
},
metadata: _metadata
}, _nzBackdrop_initializers, _nzBackdrop_extraInitializers);
if (_metadata) Object.defineProperty(this, Symbol.metadata, {
enumerable: true,
configurable: true,
writable: true,
value: _metadata
});
}
cascaderService = inject(NzCascaderService);
ngZone = inject(NgZone);
cdr = inject(ChangeDetectorRef);
i18nService = inject(NzI18nService);
elementRef = inject(ElementRef);
renderer = inject(Renderer2);
dir = inject(Directionality).valueSignal;
destroyRef = inject(DestroyRef);
nzFormStatusService = inject(NzFormStatusService, { optional: true });
noAnimation = inject(NzNoAnimationDirective, {
host: true,
optional: true
});
_nzModuleName = NZ_CONFIG_MODULE_NAME;
selectContainer;
slideAnimationEnter = slideAnimationEnter(() => this.placement().startsWith("top") ? "down" : "up");
slideAnimationLeave = slideAnimationLeave(() => this.placement().startsWith("top") ? "down" : "up");
set input(inputComponent) {
this.input$.next(inputComponent?.inputElement);
}
get input() {
return this.input$.getValue();
}
input$ = new BehaviorSubject(void 0);
menu;
overlay;
cascaderItems;
nzOpen;
nzOptions = [];
nzOptionRender = null;
nzShowInput = true;
nzShowArrow = true;
nzAllowClear = true;
nzAutoFocus = false;
nzChangeOnSelect = false;
nzDisabled = false;
nzColumnClassName;
nzExpandTrigger = "click";
nzValueProperty = "value";
nzLabelProperty = "label";
nzLabelRender = null;
nzVariant = __runInitializers(this, _nzVariant_initializers, void 0);
nzNotFoundContent = __runInitializers(this, _nzVariant_extraInitializers);
nzSize = __runInitializers(this, _nzSize_initializers, "default");
nzBackdrop = (__runInitializers(this, _nzSize_extraInitializers), __runInitializers(this, _nzBackdrop_initializers, false));
nzShowSearch = (__runInitializers(this, _nzBackdrop_extraInitializers), false);
nzPlaceHolder = "";
nzMenuClassName;
nzMenuStyle = null;
nzMouseLeaveDelay = 150;
nzMouseEnterDelay = 150;
nzStatus = "";
nzMultiple = false;
nzMaxTagCount = Infinity;
nzPlacement = "bottomLeft";
nzTriggerAction = ["click"];
nzChangeOn;
nzLoadData;
nzPrefix = null;
nzSuffixIcon = "down";
nzExpandIcon = "";
nzPopupRender = null;
get treeService() {
return this.nzTreeService;
}
nzVisibleChange = new EventEmitter();
nzOpenChange = output();
nzSelectionChange = new EventEmitter();
nzRemoved = new EventEmitter();
nzClear = new EventEmitter();
prefixCls = "ant-select";
statusCls = {};
status = "";
hasFeedback = false;
shouldShowEmpty = false;
el = this.elementRef.nativeElement;
menuOpen = signal(false, ...ngDevMode ? [{ debugName: "menuOpen" }] : /* istanbul ignore next */ []);
isLoading = false;
onChange = Function.prototype;
onTouched = Function.prototype;
positions = [...DEFAULT_CASCADER_POSITIONS];
dropdownWidthStyle;
dropdownHeightStyle = "";
isFocused = false;
locale;
isComposing = false;
get overlayOrigin() {
return this.elementRef;
}
finalSize = computed(() => {
if (this.formSize?.()) return this.formSize();
if (this.compactSize) return this.compactSize();
return this.size();
}, ...ngDevMode ? [{ debugName: "finalSize" }] : /* istanbul ignore next */ []);
finalVariant = computed(() => this.variant() || this.formVariant?.() || "outlined", ...ngDevMode ? [{ debugName: "finalVariant" }] : /* istanbul ignore next */ []);
placement = signal("bottomLeft", ...ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []);
size = signal(this.nzSize, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
variant = signal(this.nzVariant, ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
formSize = inject(NZ_FORM_SIZE, { optional: true });
formVariant = inject(NZ_FORM_VARIANT, { optional: true });
compactSize = inject(NZ_SPACE_COMPACT_SIZE, { optional: true });
inputString = "";
isOpening = false;
delayMenuTimer;
delaySelectTimer;
isNzDisableFirstChange = true;
selectedNodes = [];
get inSearchingMode() {
return this.cascaderService.inSearchingMode;
}
set inputValue(inputValue) {
this.inputString = inputValue;
this.toggleSearchingMode(!!inputValue);
}
get inputValue() {
return this.inputString;
}
get hasInput() {
return !!this.inputValue;
}
get hasValue() {
return this.cascaderService.values && this.cascaderService.values.length > 0;
}
get showLabelRender() {
return !this.hasInput && !!this.selectedNodes.length;
}
get showPlaceholder() {
return !(this.hasInput || this.hasValue);
}
get clearIconVisible() {
return this.nzAllowClear && !this.nzDisabled && (this.hasValue || this.hasInput);
}
get isLabelRenderTemplate() {
return !!this.nzLabelRender;
}
get openControlled() {
return isNotNil(this.nzOpen);
}
constructor() {
super(inject(NzCascaderTreeService));
this.cascaderService.withComponent(this);
this.destroyRef.onDestroy(() => {
this.clearDelayMenuTimer();
this.clearDelaySelectTimer();
});
onConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME, () => {
this.size.set(this.nzSize);
this.cdr.markForCheck();
});
}
ngOnInit() {
this.nzFormStatusService?.formStatusChanges.pipe(distinctUntilChanged((pre, cur) => pre.status === cur.status && pre.hasFeedback === cur.hasFeedback), takeUntilDestroyed(this.destroyRef)).subscribe(({ status, hasFeedback }) => this.setStatusStyles(status, hasFeedback));
const srv = this.cascaderService;
srv.$redraw.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.checkChildren();
this.cdr.detectChanges();
this.reposition();
this.setDropdownStyles();
});
srv.$loading.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((loading) => {
this.isLoading = loading;
});
srv.$nodeSelected.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((node) => {
if (!node) {
this.emitValue([]);
this.nzSelectionChange.emit([]);
} else {
if (!this.nzMultiple && (node.isLeaf || this.nzChangeOnSelect && this.nzExpandTrigger === "hover")) this.delaySetMenuOpen(false);
this.nzSelectionChange.emit(this.getAncestorOptionList(node));
this.cdr.markForCheck();
}
});
srv.$quitSearching.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.inputValue = "";
this.dropdownWidthStyle = "";
});
this.i18nService.localeChange.pipe(startWith(), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.setLocale());
this.size.set(this.nzSize);
this.setupSelectionChangeListener();
this.setupChangeListener();
this.setupKeydownListener();
this.setupFocusListener();
}
ngOnChanges(changes) {
const { nzOpen, nzStatus, nzSize, nzPlacement, nzOptions, nzVariant } = changes;
if (nzOpen && this.openControlled) this.setMenuOpen(nzOpen.currentValue);
if (nzOptions) this.updateOptions();
if (nzStatus) this.setStatusStyles(this.nzStatus, this.hasFeedback);
if (nzSize) this.size.set(nzSize.currentValue);
if (nzVariant) this.variant.set(nzVariant.currentValue);
if (nzPlacement) {
const { currentValue } = nzPlacement;
this.placement.set(currentValue);
const listOfPlacement = [
"bottomLeft",
"topLeft",
"bottomRight",
"topRight"
];
if (currentValue && listOfPlacement.includes(currentValue)) this.positions = [POSITION_MAP[currentValue]];
else this.positions = listOfPlacement.map((e) => POSITION_MAP[e]);
}
}
registerOnChange(fn) {
this.onChange = fn;
}
registerOnTouched(fn) {
this.onTouched = fn;
}
writeValue(value) {
if (isNotNil(value)) {
if (this.nzMultiple) this.cascaderService.values = toArray(value);
else this.cascaderService.values = [toArray(value)];
this.clearSelectedNodes();
this.updateSelectedNodes(true, false);
} else {
this.cascaderService.values = [];
this.clearSelectedNodes();
this.selectedNodes = [];
this.cascaderService.$redraw.next();
}
}
setupSelectionChangeListener() {
merge(this.nzSelectionChange, this.nzRemoved, this.nzClear).pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.updateSelectedNodes();
this.emitValue(this.cascaderService.values);
this.cascaderService.$redraw.next();
});
}
delaySetMenuOpen(open, delay = 100, setOpening = false) {
this.clearDelayMenuTimer();
if (delay) {
if (open && setOpening) this.isOpening = true;
this.delayMenuTimer = setTimeout(() => {
this.setMenuOpen(open);
this.cdr.detectChanges();
this.clearDelayMenuTimer();
if (open) setTimeout(() => {
this.isOpening = false;
}, 100);
}, delay);
} else this.setMenuOpen(open);
}
setMenuOpen(open) {
if (this.nzDisabled || this.menuOpen() === open) return;
if (this.openControlled && this.nzOpen !== open) {
this.nzVisibleChange.emit(open);
this.nzOpenChange.emit(open);
return;
}
if (open) {
this.cascaderService.$redraw.next();
this.updateSelectedNodes(true);
this.scrollToActivatedOptions();
} else this.inputValue = "";
this.menuOpen.set(open);
this.nzVisibleChange.emit(open);
this.nzOpenChange.emit(open);
this.cdr.detectChanges();
}
clearDelayMenuTimer() {
if (this.delayMenuTimer) {
clearTimeout(this.delayMenuTimer);
this.delayMenuTimer = void 0;
}
}
clearSelection(event) {
if (event) {
event.preventDefault();
event.stopPropagation();
}
this.clearSelectedNodes();
this.inputValue = "";
this.setMenuOpen(false);
this.cascaderService.clear();
this.nzClear.emit();
}
clearSelectedNodes() {
this.selectedNodes.forEach((node) => {
this.removeSelected(node, false);
});
}
emitValue(values) {
if (this.nzMultiple) this.onChange(values);
else this.onChange(values?.length ? values[0] : []);
}
getSubmitValue() {
if (this.nzMultiple) return this.cascaderService.values;
else return this.cascaderService.values?.length ? this.cascaderService.values[0] : [];
}
focus() {
if (!this.isFocused) {
(this.input?.nativeElement || this.el).focus();
this.isFocused = true;
}
}
blur() {
if (this.isFocused) {
(this.input?.nativeElement || this.el).blur();
this.isFocused = false;
}
}
handleInputBlur() {
this.menuOpen() ? this.focus() : this.blur();
}
handleInputFocus() {
this.focus();
}
isComposingChange(isComposing) {
this.isComposing = isComposing;
}
onTriggerClick() {
if (this.nzDisabled) return;
if (this.nzShowSearch) this.focus();
if (this.isActionTrigger("click")) this.delaySetMenuOpen(!this.menuOpen(), 100);
this.onTouched();
}
onTriggerMouseEnter() {
if (this.nzDisabled || !this.isActionTrigger("hover")) return;
this.delaySetMenuOpen(true, this.nzMouseEnterDelay, true);
}
onTriggerMouseLeave(event) {
if (this.nzDisabled || !this.menuOpen() || this.isOpening || !this.isActionTrigger("hover")) {
event.preventDefault();
return;
}
const mouseTarget = event.relatedTarget;
const hostEl = this.el;
const menuEl = this.menu && this.menu.nativeElement;
if (hostEl.contains(mouseTarget) || menuEl && menuEl.contains(mouseTarget)) return;
this.delaySetMenuOpen(false, this.nzMouseLeaveDelay);
}
onOptionMouseEnter(node, columnIndex, event) {
event.preventDefault();
if (this.nzExpandTrigger === "hover") {
if (!node.isLeaf) this.delaySetOptionActivated(node, columnIndex, false);
else this.cascaderService.setNodeDeactivatedSinceColumn(columnIndex);
}
}
onOptionMouseLeave(node, _columnIndex, event) {
event.preventDefault();
if (this.nzExpandTrigger === "hover" && !node.isLeaf) this.clearDelaySelectTimer();
}
getAncestorOptionList(node) {
const ancestors = this.treeService.getAncestorNodeList(node);
return this.treeService.toOptions(ancestors);
}
updateSelectedNodes(init = false, updateValue = true) {
const value = this.cascaderService.values;
const multiple = this.nzMultiple;
const updateNodesAndValue = (shouldUpdateValue) => {
this.selectedNodes = [...this.nzMultiple ? this.getCheckedNodeList() : this.getSelectedNodeList()].sort((a, b) => {
const indexA = value.indexOf(a.key);
const indexB = value.indexOf(b.key);
if (indexA !== -1 && indexB !== -1) return indexA - indexB;
if (indexA !== -1) return -1;
if (indexB !== -1) return 1;
return 0;
});
if (shouldUpdateValue) this.cascaderService.values = this.selectedNodes.map((node) => this.getAncestorOptionList(node).map((o) => this.cascaderService.getOptionValue(o)));
this.cascaderService.$redraw.next();
};
if (init) {
const defaultValue = value[0];
const lastColumnIndex = defaultValue?.length ? defaultValue.length - 1 : 0;
this.treeService.fieldNames = {
value: this.nzValueProperty,
label: this.nzLabelProperty
};
this.treeService.isMultiple = multiple;
this.treeService.isCheckStrictly = false;
const checkNodeStates = () => {
if (multiple) this.treeService.conductCheckPaths(value, this.treeService.isCheckStrictly);
else this.treeService.conductSelectedPaths(value);
};
const initColumnWithIndex = (columnIndex = 0) => {
const activatedOptionSetter = () => {
const currentValue = defaultValue?.[columnIndex];
if (!isNotNil(currentValue)) {
this.cascaderService.$redraw.next();
return;
}
const node = this.cascaderService.columns[columnIndex].find((n) => this.cascaderService.getOptionValue(n.origin) === currentValue) || null;
if (isNotNil(node)) {
this.cascaderService.setNodeActivated(node, columnIndex, false, multiple, false);
if (columnIndex < lastColumnIndex) initColumnWithIndex(columnIndex + 1);
}
checkNodeStates();
updateNodesAndValue(false);
};
if (this.cascaderService.isLoaded(columnIndex) || !this.nzLoadData) activatedOptionSetter();
else {
const node = this.cascaderService.activatedNodes[columnIndex - 1];
this.cascaderService.loadChildren(node, columnIndex - 1, activatedOptionSetter);
}
};
if (this.nzLoadData) initColumnWithIndex();
else {
const nodes = this.coerceTreeNodes(this.nzOptions || []);
this.treeService.initTree(nodes);
this.cascaderService.setColumnData(nodes, 0);
initColumnWithIndex();
}
}
updateNodesAndValue(updateValue);
}
onOptionClick(node, columnIndex, event) {
if (event) event.preventDefault();
if (node && node.isDisabled) return;
this.el.focus();
if (this.nzMultiple && node.isLeaf) this.onOptionCheck(node, columnIndex, true);
else this.inSearchingMode ? this.cascaderService.setSearchOptionSelected(node, this.nzMultiple) : this.cascaderService.setNodeActivated(node, columnIndex, !this.nzMultiple);
}
onOptionCheck(node, columnIndex, performActivate = false) {
if (!this.nzMultiple || node.isDisabled || node.isDisableCheckbox) return;
node.isChecked = !node.isChecked;
node.isHalfChecked = false;
this.treeService.setCheckedNodeList(node);
this.treeService.conduct(node, this.treeService.isCheckStrictly);
if (this.inSearchingMode) this.cascaderService.setSearchOptionSelected(node, true);
else if (performActivate) this.cascaderService.setNodeActivated(node, columnIndex, true, true);
else this.cascaderService.setNodeSelected(node, columnIndex, true);
}
removeSelected(node, emitEvent = true) {
node.isSelected = false;
node.isChecked = false;
if (this.nzMultiple) this.treeService.conduct(node, this.treeService.isCheckStrictly);
this.treeService.setSelectedNodeList(node, this.nzMultiple);
if (emitEvent) this.nzRemoved.emit(node.origin);
}
onClickOutside(event) {
const target = _getEventTarget(event);
if (!this.el.contains(target)) this.closeMenu();
}
onPositionChange(position) {
const placement = getPlacementName(position);
this.placement.set(placement);
}
updateOptions() {
const nodes = this.coerceTreeNodes(this.nzOptions || []);
this.treeService.initTree(nodes);
this.cascaderService.setColumnData(nodes, 0);
this.updateSelectedNodes(true);
if (this.inSearchingMode) {
this.cascaderService.setSearchingMode(this.inSearchingMode);
this.cascaderService.prepareSearchOptions(this.inputValue);
}
}
isActionTrigger(action) {
return typeof this.nzTriggerAction === "string" ? this.nzTriggerAction === action : this.nzTriggerAction.indexOf(action) !== -1;
}
onEnter() {
const columnIndex = Math.max(this.cascaderService.activatedNodes.length - 1, 0);
const node = this.cascaderService.activatedNodes[columnIndex];
if (node && !node.isDisabled) this.nzMultiple ? this.onOptionCheck(node, columnIndex, true) : this.inSearchingMode ? this.cascaderService.setSearchOptionSelected(node) : this.cascaderService.setNodeActivated(node, columnIndex, true);
}
moveUpOrDown(isUp) {
const columnIndex = Math.max(this.cascaderService.activatedNodes.length - 1, 0);
const activatedNode = this.cascaderService.activatedNodes[columnIndex];
const options = this.cascaderService.columns[columnIndex] || [];
const length = options.length;
let nextIndex = -1;
if (!activatedNode) nextIndex = isUp ? length : -1;
else nextIndex = options.indexOf(activatedNode);
while (true) {
nextIndex = isUp ? nextIndex - 1 : nextIndex + 1;
if (nextIndex < 0 || nextIndex >= length) break;
const nextOption = options[nextIndex];
if (!nextOption || nextOption.isDisabled || nextOption.isDisableCheckbox) continue;
this.cascaderService.setNodeActivated(nextOption, columnIndex);
break;
}
}
prevColumn() {
if (this.cascaderService.activatedNodes.length) {
this.cascaderService.activatedNodes.pop();
this.cascaderService.setNodeDeactivatedSinceColumn(this.cascaderService.activatedNodes.length);
if (!this.cascaderService.activatedNodes.length) this.setMenuOpen(false);
}
}
nextColumn() {
const length = this.cascaderService.activatedNodes.length;
const options = this.cascaderService.columns[length];
if (options && options.length) {
const nextOpt = options.find((o) => !o.isDisabled && !o.isDisableCheckbox);
if (nextOpt) this.cascaderService.setNodeActivated(nextOpt, length);
}
}
clearDelaySelectTimer() {
if (this.delaySelectTimer) {
clearTimeout(this.delaySelectTimer);
this.delaySelectTimer = void 0;
}
}
delaySetOptionActivated(node, columnIndex, performSelect) {
this.clearDelaySelectTimer();
this.delaySelectTimer = setTimeout(() => {
this.cascaderService.setNodeActivated(node, columnIndex, performSelect, this.nzMultiple);
this.delaySelectTimer = void 0;
}, 150);
}
toggleSearchingMode(toSearching) {
if (this.inSearchingMode !== toSearching) this.cascaderService.setSearchingMode(toSearching);
if (this.inSearchingMode) this.cascaderService.prepareSearchOptions(this.inputValue);
}
isOptionActivated(node, index) {
return this.cascaderService.activatedNodes[index] === node;
}
setDisabledState(isDisabled) {
this.nzDisabled = this.isNzDisableFirstChange && this.nzDisabled || isDisabled;
this.isNzDisableFirstChange = false;
if (this.nzDisabled) this.closeMenu();
this.cdr.markForCheck();
}
closeMenu() {
this.blur();
this.clearDelayMenuTimer();
this.setMenuOpen(false);
if (!this.hasValue && this.cascaderService.columns.length) this.cascaderService.dropBehindColumns(0);
}
reposition() {
if (this.overlay && this.overlay.overlayRef && this.menuOpen()) Promise.resolve().then(() => {
this.overlay.overlayRef.updatePosition();
this.cdr.markForCheck();
});
}
checkChildren() {
if (this.cascaderItems) this.cascaderItems.forEach((item) => item.markForCheck());
}
setDropdownStyles() {
const firstColumn = this.cascaderService.columns[0];
this.shouldShowEmpty = this.inSearchingMode && (!firstColumn || !firstColumn.length) || !(this.nzOptions && this.nzOptions.length) && !this.nzLoadData;
this.dropdownHeightStyle = this.shouldShowEmpty ? "auto" : "";
if (this.input) this.dropdownWidthStyle = this.inSearchingMode || this.shouldShowEmpty ? `${this.selectContainer.nativeElement.offsetWidth}px` : "";
}
setStatusStyles(status, hasFeedback) {
this.status = status;
this.hasFeedback = hasFeedback;
this.cdr.markForCheck();
this.statusCls = getStatusClassNames(this.prefixCls, status, hasFeedback);
Object.keys(this.statusCls).forEach((status) => {
if (this.statusCls[status]) this.renderer.addClass(this.elementRef.nativeElement, status);
else this.renderer.removeClass(this.elementRef.nativeElement, status);
});
}
setLocale() {
this.locale = this.i18nService.getLocaleData("global");
this.cdr.markForCheck();
}
scrollToActivatedOptions() {
this.ngZone.runOutsideAngular(() => {
Promise.resolve().then(() => {
this.cascaderItems.toArray().filter((e) => e.activated).forEach((e) => {
e.nativeElement.scrollIntoView({
block: "start",
inline: "nearest"
});
});
});
});
}
setupChangeListener() {
this.input$.pipe(switchMap((input) => fromEventOutsideAngular(input?.nativeElement, "change")), takeUntilDestroyed(this.destroyRef)).subscribe((event) => event.stopPropagation());
}
setupFocusListener() {
this.input$.pipe(switchMap((input) => fromEventOutsideAngular(input?.nativeElement, "focus")), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.handleInputFocus());
this.input$.pipe(switchMap((input) => fromEventOutsideAngular(input?.nativeElement, "blur")), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.handleInputBlur());
}
setupKeydownListener() {
fromEventOutsideAngular(this.el, "keydown").pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
const keyCode = event.keyCode;
if (keyCode !== DOWN_ARROW && keyCode !== UP_ARROW && keyCode !== LEFT_ARROW && keyCode !== RIGHT_ARROW && keyCode !== ENTER && keyCode !== BACKSPACE && keyCode !== ESCAPE) return;
if (!this.menuOpen() && keyCode !== BACKSPACE && keyCode !== ESCAPE) return this.ngZone.run(() => this.setMenuOpen(true));
if (this.inSearchingMode && (keyCode === BACKSPACE || keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW)) return;
if (!this.menuOpen()) return;
event.preventDefault();
this.ngZone.run(() => {
switch (keyCode) {
case DOWN_ARROW:
this.moveUpOrDown(false);
break;
case UP_ARROW:
this.moveUpOrDown(true);
break;
case LEFT_ARROW:
if (this.dir() === "rtl") this.nextColumn();
else this.prevColumn();
break;
case RIGHT_ARROW:
if (this.dir() === "rtl") this.prevColumn();
else this.nextColumn();
break;
case ENTER:
this.onEnter();
break;
case BACKSPACE: this.prevColumn();
}
this.cdr.markForCheck();
});
});
}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderComponent,
deps: [],
target: i0.ɵɵFactoryTarget.Component
});
static ɵcmp = i0.ɵɵngDeclareComponent({
minVersion: "17.0.0",
version: "22.2.2",
type: NzCascaderComponent,
isStandalone: true,
selector: "nz-cascader, [nz-cascader]",
inputs: {
nzOpen: "nzOpen",
nzOptions: "nzOptions",
nzOptionRender: "nzOptionRender",
nzShowInput: [
"nzShowInput",
"nzShowInput",
booleanAttribute
],
nzShowArrow: [
"nzShowArrow",
"nzShowArrow",
booleanAttribute
],
nzAllowClear: [
"nzAllowClear",
"nzAllowClear",
booleanAttribute
],
nzAutoFocus: [
"nzAutoFocus",
"nzAutoFocus",
booleanAttribute
],
nzChangeOnSelect: [
"nzChangeOnSelect",
"nzChangeOnSelect",
booleanAttribute
],
nzDisabled: [
"nzDisabled",
"nzDisabled",
booleanAttribute
],
nzColumnClassName: "nzColumnClassName",
nzExpandTrigger: "nzExpandTrigger",
nzValueProperty: "nzValueProperty",
nzLabelProperty: "nzLabelProperty",
nzLabelRender: "nzLabelRender",
nzVariant: "nzVariant",
nzNotFoundContent: "nzNotFoundContent",
nzSize: "nzSize",
nzBackdrop: "nzBackdrop",
nzShowSearch: "nzShowSearch",
nzPlaceHolder: "nzPlaceHolder",
nzMenuClassName: "nzMenuClassName",
nzMenuStyle: "nzMenuStyle",
nzMouseLeaveDelay: [
"nzMouseLeaveDelay",
"nzMouseLeaveDelay",
numberAttribute
],
nzMouseEnterDelay: [
"nzMouseEnterDelay",
"nzMouseEnterDelay",
numberAttribute
],
nzStatus: "nzStatus",
nzMultiple: [
"nzMultiple",
"nzMultiple",
booleanAttribute
],
nzMaxTagCount: "nzMaxTagCount",
nzPlacement: "nzPlacement",
nzTriggerAction: "nzTriggerAction",
nzChangeOn: "nzChangeOn",
nzLoadData: "nzLoadData",
nzPrefix: "nzPrefix",
nzSuffixIcon: "nzSuffixIcon",
nzExpandIcon: "nzExpandIcon",
nzPopupRender: "nzPopupRender"
},
outputs: {
nzVisibleChange: "nzVisibleChange",
nzOpenChange: "nzOpenChange",
nzSelectionChange: "nzSelectionChange",
nzRemoved: "nzRemoved",
nzClear: "nzClear"
},
host: {
listeners: {
"click": "onTriggerClick()",
"mouseenter": "onTriggerMouseEnter()",
"mouseleave": "onTriggerMouseLeave($event)"
},
properties: {
"attr.tabIndex": "\"0\"",
"class.ant-select-in-form-item": "!!nzFormStatusService",
"class.ant-select-lg": "finalSize() === \"large\"",
"class.ant-select-sm": "finalSize() === \"small\"",
"class.ant-select-allow-clear": "nzAllowClear",
"class.ant-select-show-arrow": "nzShowArrow",
"class.ant-select-show-search": "!!nzShowSearch",
"class.ant-select-disabled": "nzDisabled",
"class.ant-select-outlined": "finalVariant() === 'outlined'",
"class.ant-select-borderless": "finalVariant() === 'borderless'",
"class.ant-select-filled": "finalVariant() === 'filled'",
"class.ant-select-underlined": "finalVariant() === 'underlined'",
"class.ant-select-open": "menuOpen()",
"class.ant-select-focused": "isFocused",
"class.ant-select-multiple": "nzMultiple",
"class.ant-select-single": "!nzMultiple",
"class.ant-select-rtl": "dir() === 'rtl'"
},
classAttribute: "ant-select ant-cascader"
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NzCascaderComponent),
multi: true
},
{
provide: NZ_SPACE_COMPACT_ITEM_TYPE,
useValue: "select"
},
NzCascaderService,
NzCascaderTreeService
],
viewQueries: [
{
propertyName: "selectContainer",
first: true,
predicate: ["selectContainer"],
descendants: true
},
{
propertyName: "input",
first: true,
predicate: NzSelectSearchComponent,
descendants: true
},
{
propertyName: "menu",
first: true,
predicate: ["menu"],
descendants: true
},
{
propertyName: "overlay",
first: true,
predicate: CdkConnectedOverlay,
descendants: true
},
{
propertyName: "cascaderItems",
predicate: NzCascaderOptionComponent,
descendants: true
}
],
exportAs: ["nzCascader"],
usesInheritance: true,
usesOnChanges: true,
hostDirectives: [{ directive: i1.NzSpaceCompactItemDirective }],
ngImport: i0,
template: `
@if (nzShowInput) {
<div #selectContainer class="ant-select-selector">
@if (nzPrefix; as prefix) {
<div class="ant-select-prefix">
<ng-container *nzStringTemplateOutlet="prefix">{{ prefix }}</ng-container>
</div>
}
<span class="ant-select-selection-wrap">
@if (nzMultiple) {
<div class="ant-select-selection-overflow">
@for (node of selectedNodes | slice: 0 : nzMaxTagCount; track node) {
<div class="ant-select-selection-overflow-item">
<nz-select-item
deletable
[disabled]="nzDisabled"
[label]="node | nzDisplayRender"
[contentTemplateOutlet]="isLabelRenderTemplate ? nzLabelRender : null"
[contentTemplateOutletContext]="node | nzDisplayRenderContext"
(delete)="removeSelected(node)"
/>
</div>
}
@if (selectedNodes.length > nzMaxTagCount) {
<div class="ant-select-selection-overflow-item">
<nz-select-item [label]="'+ ' + (selectedNodes.length - nzMaxTagCount) + ' ...'" />
</div>
}
<div class="ant-select-selection-overflow-item ant-select-selection-overflow-item-suffix">
<nz-select-search
[showInput]="!!nzShowSearch"
(isComposingChange)="isComposingChange($event)"
[value]="inputValue"
(valueChange)="inputValue = $event"
[mirrorSync]="true"
[disabled]="nzDisabled"
[autofocus]="nzAutoFocus"
[focusTrigger]="menuOpen()"
/>
</div>
</div>
} @else {
<nz-select-search
[showInput]="!!nzShowSearch"
(isComposingChange)="isComposingChange($event)"
[value]="inputValue"
(valueChange)="inputValue = $event"
[mirrorSync]="false"
[disabled]="nzDisabled"
[autofocus]="nzAutoFocus"
[focusTrigger]="menuOpen()"
/>
@if (showLabelRender) {
<nz-select-item
[disabled]="nzDisabled"
[label]="selectedNodes[0] | nzDisplayRender"
[contentTemplateOutlet]="isLabelRenderTemplate ? nzLabelRender : null"
[contentTemplateOutletContext]="selectedNodes[0] | nzDisplayRenderContext"
/>
}
}
@if (showPlaceholder) {
<nz-select-placeholder
[placeholder]="nzPlaceHolder || locale?.placeholder!"
[style.display]="inputValue || isComposing ? 'none' : 'block'"
/>
}
</span>
</div>
@if (nzShowArrow) {
<span class="ant-select-arrow" [class.ant-select-arrow-loading]="isLoading">
@if (!isLoading) {
<nz-icon [nzType]="$any(nzSuffixIcon)" [class.ant-cascader-picker-arrow-expand]="menuOpen()" />
} @else {
<nz-icon nzType="loading" />
}
@if (hasFeedback && !!status) {
<nz-form-item-feedback-icon [status]="status" />
}
</span>
}
@if (clearIconVisible) {
<nz-select-clear (clear)="clearSelection($event)" />
}
}
<ng-content />
<ng-template
cdkConnectedOverlay
nzConnectedOverlay
[cdkConnectedOverlayOffsetY]="placement().startsWith('top') ? -4 : 4"
[cdkConnectedOverlayHasBackdrop]="nzBackdrop"
[cdkConnectedOverlayOrigin]="overlayOrigin"
[cdkConnectedOverlayPositions]="positions"
cdkConnectedOverlayTransformOriginOn=".ant-cascader-dropdown"
[cdkConnectedOverlayOpen]="menuOpen()"
(overlayOutsideClick)="onClickOutside($event)"
(detach)="closeMenu()"
(positionChange)="onPositionChange($event)"
>
<div
class="ant-select-dropdown ant-cascader-dropdown"
[class.ant-select-dropdown-placement-bottomLeft]="placement() === 'bottomLeft'"
[class.ant-select-dropdown-placement-bottomRight]="placement() === 'bottomRight'"
[class.ant-select-dropdown-placement-topLeft]="placement() === 'topLeft'"
[class.ant-select-dropdown-placement-topRight]="placement() === 'topRight'"
[class.ant-cascader-dropdown-rtl]="dir() === 'rtl'"
[animate.enter]="slideAnimationEnter()"
[animate.leave]="slideAnimationLeave()"
[nzNoAnimation]="noAnimation?.nzNoAnimation?.()"
(mouseenter)="onTriggerMouseEnter()"
(mouseleave)="onTriggerMouseLeave($event)"
>
@if (nzPopupRender) {
<ng-container [ngTemplateOutlet]="nzPopupRender" [ngTemplateOutletContext]="{ $implicit: menuTemplate }" />
} @else {
<ng-container [ngTemplateOutlet]="menuTemplate" />
}
</div>
</ng-template>
<ng-template #menuTemplate>
<div
#menu
class="ant-cascader-menus"
[class.ant-cascader-rtl]="dir() === 'rtl'"
[class.ant-cascader-menus-hidden]="!menuOpen()"
[class.ant-cascader-menu-empty]="shouldShowEmpty"
[class]="nzMenuClassName"
[style]="nzMenuStyle"
>
@if (shouldShowEmpty) {
<ul class="ant-cascader-menu" [style.width]="dropdownWidthStyle" [style.height]="dropdownHeightStyle">
<li class="ant-cascader-menu-item ant-cascader-menu-item-disabled">
<nz-embed-empty
class="ant-cascader-menu-item-content"
nzComponentName="cascader"
[specificContent]="nzNotFoundContent"
/>
</li>
</ul>
} @else {
@for (options of cascaderService.columns; track options; let i = $index) {
<ul
class="ant-cascader-menu"
role="menuitemcheckbox"
[class]="nzColumnClassName"
[style.height]="dropdownHeightStyle"
>
@for (option of options; track option) {
<li
nz-cascader-option
[expandIcon]="nzExpandIcon"
[columnIndex]="i"
[nzLabelProperty]="nzLabelProperty"
[optionTemplate]="nzOptionRender"
[activated]="isOptionActivated(option, i)"
[highlightText]="inSearchingMode ? inputValue : ''"
[node]="option"
[dir]="dir()"
[checkable]="nzMultiple"
(mouseenter)="onOptionMouseEnter(option, i, $event)"
(mouseleave)="onOptionMouseLeave(option, i, $event)"
(click)="onOptionClick(option, i, $event)"
(check)="onOptionCheck(option, i)"
></li>
}
</ul>
}
}
</div>
</ng-template>
`,
isInline: true,
dependencies: [
{
kind: "directive",
type: NgTemplateOutlet,
selector: "[ngTemplateOutlet]",
inputs: [
"ngTemplateOutletContext",
"ngTemplateOutlet",
"ngTemplateOutletInjector"
]
},
{
kind: "ngmodule",
type: OverlayModule
},
{
kind: "directive",
type: i2.CdkConnectedOverlay,
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
inputs: [
"cdkConnectedOverlayOrigin",
"cdkConnectedOverlayPositions",
"cdkConnectedOverlayPositionStrategy",
"cdkConnectedOverlayOffsetX",
"cdkConnectedOverlayOffsetY",
"cdkConnectedOverlayWidth",
"cdkConnectedOverlayHeight",
"cdkConnectedOverlayMinWidth",
"cdkConnectedOverlayMinHeight",
"cdkConnectedOverlayBackdropClass",
"cdkConnectedOverlayPanelClass",
"cdkConnectedOverlayViewportMargin",
"cdkConnectedOverlayScrollStrategy",
"cdkConnectedOverlayOpen",
"cdkConnectedOverlayDisableClose",
"cdkConnectedOverlayTransformOriginOn",
"cdkConnectedOverlayHasBackdrop",
"cdkConnectedOverlayLockPosition",
"cdkConnectedOverlayFlexibleDimensions",
"cdkConnectedOverlayGrowAfterOpen",
"cdkConnectedOverlayPush",
"cdkConnectedOverlayDisposeOnNavigation",
"cdkConnectedOverlayUsePopover",
"cdkConnectedOverlayMatchWidth",
"cdkConnectedOverlay"
],
outputs: [
"backdropClick",
"positionChange",
"attach",
"detach",
"overlayKeydown",
"overlayOutsideClick"
],
exportAs: ["cdkConnectedOverlay"]
},
{
kind: "directive",
type: i2.ɵɵDir,
selector: "[dir]",
inputs: ["dir"],
outputs: ["dirChange"],
exportAs: ["dir"]
},
{
kind: "ngmodule",
type: FormsModule
},
{
kind: "ngmodule",
type: NzIconModule
},
{
kind: "directive",
type: i1$1.NzIconDirective,
selector: "nz-icon,[nz-icon]",
inputs: [
"nzType",
"nzTheme",
"nzTwotoneColor",
"nzSpin",
"nzRotate",
"nzIconfont",
"aria-label"
],
exportAs: ["nzIcon"]
},
{
kind: "ngmodule",
type: NzEmptyModule
},
{
kind: "component",
type: i4.NzEmbedEmptyComponent,
selector: "nz-embed-empty",
inputs: ["nzComponentName", "specificContent"],
exportAs: ["nzEmbedEmpty"]
},
{
kind: "component",
type: NzFormItemFeedbackIconComponent,
selector: "nz-form-item-feedback-icon",
inputs: ["status"],
exportAs: ["nzFormFeedbackIcon"]
},
{
kind: "ngmodule",
type: NzOverlayModule
},
{
kind: "directive",
type: i5.NzConnectedOverlayDirective,
selector: "[cdkConnectedOverlay][nzConnectedOverlay]",
inputs: ["nzArrowPointAtCenter"],
exportAs: ["nzConnectedOverlay"]
},
{
kind: "directive",
type: NzNoAnimationDirective,
selector: "[nzNoAnimation]",
inputs: ["nzNoAnimation"],
exportAs: ["nzNoAnimation"]
},
{
kind: "component",
type: NzSelectClearComponent,
selector: "nz-select-clear",
inputs: ["clearIcon"],
outputs: ["clear"]
},
{
kind: "component",
type: NzSelectItemComponent,
selector: "nz-select-item",
inputs: [
"disabled",
"label",
"displayLabelInHtml",
"deletable",
"removeIcon",
"contentTemplateOutletContext",
"contentTemplateOutlet"
],
outputs: ["delete"]
},
{
kind: "component",
type: NzSelectPlaceholderComponent,
selector: "nz-select-placeholder",
inputs: ["placeholder"]
},
{
kind: "component",
type: NzSelectSearchComponent,
selector: "nz-select-search",
inputs: [
"nzId",
"disabled",
"mirrorSync",
"showInput",
"focusTrigger",
"value",
"autofocus"
],
outputs: ["valueChange", "isComposingChange"]
},
{
kind: "component",
type: NzCascaderOptionComponent,
selector: "[nz-cascader-option]",
inputs: [
"optionTemplate",
"node",
"activated",
"highlightText",
"nzLabelProperty",
"columnIndex",
"expandIcon",
"dir",
"checkable"
],
outputs: ["check"],
exportAs: ["nzCascaderOption"]
},
{
kind: "directive",
type: NzStringTemplateOutletDirective,
selector: "[nzStringTemplateOutlet]",
inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"],
exportAs: ["nzStringTemplateOutlet"]
},
{
kind: "pipe",
type: SlicePipe,
name: "slice"
},
{
kind: "pipe",
type: NzDisplayRenderPipe,
name: "nzDisplayRender"
},
{
kind: "pipe",
type: NzDisplayRenderContextPipe,
name: "nzDisplayRenderContext"
}
],
encapsulation: i0.ViewEncapsulation.None
});
};
})();
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderComponent,
decorators: [{
type: Component,
args: [{
selector: "nz-cascader, [nz-cascader]",
exportAs: "nzCascader",
encapsulation: ViewEncapsulation.None,
template: `
@if (nzShowInput) {
<div #selectContainer class="ant-select-selector">
@if (nzPrefix; as prefix) {
<div class="ant-select-prefix">
<ng-container *nzStringTemplateOutlet="prefix">{{ prefix }}</ng-container>
</div>
}
<span class="ant-select-selection-wrap">
@if (nzMultiple) {
<div class="ant-select-selection-overflow">
@for (node of selectedNodes | slice: 0 : nzMaxTagCount; track node) {
<div class="ant-select-selection-overflow-item">
<nz-select-item
deletable
[disabled]="nzDisabled"
[label]="node | nzDisplayRender"
[contentTemplateOutlet]="isLabelRenderTemplate ? nzLabelRender : null"
[contentTemplateOutletContext]="node | nzDisplayRenderContext"
(delete)="removeSelected(node)"
/>
</div>
}
@if (selectedNodes.length > nzMaxTagCount) {
<div class="ant-select-selection-overflow-item">
<nz-select-item [label]="'+ ' + (selectedNodes.length - nzMaxTagCount) + ' ...'" />
</div>
}
<div class="ant-select-selection-overflow-item ant-select-selection-overflow-item-suffix">
<nz-select-search
[showInput]="!!nzShowSearch"
(isComposingChange)="isComposingChange($event)"
[value]="inputValue"
(valueChange)="inputValue = $event"
[mirrorSync]="true"
[disabled]="nzDisabled"
[autofocus]="nzAutoFocus"
[focusTrigger]="menuOpen()"
/>
</div>
</div>
} @else {
<nz-select-search
[showInput]="!!nzShowSearch"
(isComposingChange)="isComposingChange($event)"
[value]="inputValue"
(valueChange)="inputValue = $event"
[mirrorSync]="false"
[disabled]="nzDisabled"
[autofocus]="nzAutoFocus"
[focusTrigger]="menuOpen()"
/>
@if (showLabelRender) {
<nz-select-item
[disabled]="nzDisabled"
[label]="selectedNodes[0] | nzDisplayRender"
[contentTemplateOutlet]="isLabelRenderTemplate ? nzLabelRender : null"
[contentTemplateOutletContext]="selectedNodes[0] | nzDisplayRenderContext"
/>
}
}
@if (showPlaceholder) {
<nz-select-placeholder
[placeholder]="nzPlaceHolder || locale?.placeholder!"
[style.display]="inputValue || isComposing ? 'none' : 'block'"
/>
}
</span>
</div>
@if (nzShowArrow) {
<span class="ant-select-arrow" [class.ant-select-arrow-loading]="isLoading">
@if (!isLoading) {
<nz-icon [nzType]="$any(nzSuffixIcon)" [class.ant-cascader-picker-arrow-expand]="menuOpen()" />
} @else {
<nz-icon nzType="loading" />
}
@if (hasFeedback && !!status) {
<nz-form-item-feedback-icon [status]="status" />
}
</span>
}
@if (clearIconVisible) {
<nz-select-clear (clear)="clearSelection($event)" />
}
}
<ng-content />
<ng-template
cdkConnectedOverlay
nzConnectedOverlay
[cdkConnectedOverlayOffsetY]="placement().startsWith('top') ? -4 : 4"
[cdkConnectedOverlayHasBackdrop]="nzBackdrop"
[cdkConnectedOverlayOrigin]="overlayOrigin"
[cdkConnectedOverlayPositions]="positions"
cdkConnectedOverlayTransformOriginOn=".ant-cascader-dropdown"
[cdkConnectedOverlayOpen]="menuOpen()"
(overlayOutsideClick)="onClickOutside($event)"
(detach)="closeMenu()"
(positionChange)="onPositionChange($event)"
>
<div
class="ant-select-dropdown ant-cascader-dropdown"
[class.ant-select-dropdown-placement-bottomLeft]="placement() === 'bottomLeft'"
[class.ant-select-dropdown-placement-bottomRight]="placement() === 'bottomRight'"
[class.ant-select-dropdown-placement-topLeft]="placement() === 'topLeft'"
[class.ant-select-dropdown-placement-topRight]="placement() === 'topRight'"
[class.ant-cascader-dropdown-rtl]="dir() === 'rtl'"
[animate.enter]="slideAnimationEnter()"
[animate.leave]="slideAnimationLeave()"
[nzNoAnimation]="noAnimation?.nzNoAnimation?.()"
(mouseenter)="onTriggerMouseEnter()"
(mouseleave)="onTriggerMouseLeave($event)"
>
@if (nzPopupRender) {
<ng-container [ngTemplateOutlet]="nzPopupRender" [ngTemplateOutletContext]="{ $implicit: menuTemplate }" />
} @else {
<ng-container [ngTemplateOutlet]="menuTemplate" />
}
</div>
</ng-template>
<ng-template #menuTemplate>
<div
#menu
class="ant-cascader-menus"
[class.ant-cascader-rtl]="dir() === 'rtl'"
[class.ant-cascader-menus-hidden]="!menuOpen()"
[class.ant-cascader-menu-empty]="shouldShowEmpty"
[class]="nzMenuClassName"
[style]="nzMenuStyle"
>
@if (shouldShowEmpty) {
<ul class="ant-cascader-menu" [style.width]="dropdownWidthStyle" [style.height]="dropdownHeightStyle">
<li class="ant-cascader-menu-item ant-cascader-menu-item-disabled">
<nz-embed-empty
class="ant-cascader-menu-item-content"
nzComponentName="cascader"
[specificContent]="nzNotFoundContent"
/>
</li>
</ul>
} @else {
@for (options of cascaderService.columns; track options; let i = $index) {
<ul
class="ant-cascader-menu"
role="menuitemcheckbox"
[class]="nzColumnClassName"
[style.height]="dropdownHeightStyle"
>
@for (option of options; track option) {
<li
nz-cascader-option
[expandIcon]="nzExpandIcon"
[columnIndex]="i"
[nzLabelProperty]="nzLabelProperty"
[optionTemplate]="nzOptionRender"
[activated]="isOptionActivated(option, i)"
[highlightText]="inSearchingMode ? inputValue : ''"
[node]="option"
[dir]="dir()"
[checkable]="nzMultiple"
(mouseenter)="onOptionMouseEnter(option, i, $event)"
(mouseleave)="onOptionMouseLeave(option, i, $event)"
(click)="onOptionClick(option, i, $event)"
(check)="onOptionCheck(option, i)"
></li>
}
</ul>
}
}
</div>
</ng-template>
`,
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NzCascaderComponent),
multi: true
},
{
provide: NZ_SPACE_COMPACT_ITEM_TYPE,
useValue: "select"
},
NzCascaderService,
NzCascaderTreeService
],
host: {
"[attr.tabIndex]": "\"0\"",
class: "ant-select ant-cascader",
"[class.ant-select-in-form-item]": "!!nzFormStatusService",
"[class.ant-select-lg]": "finalSize() === \"large\"",
"[class.ant-select-sm]": "finalSize() === \"small\"",
"[class.ant-select-allow-clear]": "nzAllowClear",
"[class.ant-select-show-arrow]": "nzShowArrow",
"[class.ant-select-show-search]": "!!nzShowSearch",
"[class.ant-select-disabled]": "nzDisabled",
"[class.ant-select-outlined]": `finalVariant() === 'outlined'`,
"[class.ant-select-borderless]": `finalVariant() === 'borderless'`,
"[class.ant-select-filled]": `finalVariant() === 'filled'`,
"[class.ant-select-underlined]": `finalVariant() === 'underlined'`,
"[class.ant-select-open]": "menuOpen()",
"[class.ant-select-focused]": "isFocused",
"[class.ant-select-multiple]": "nzMultiple",
"[class.ant-select-single]": "!nzMultiple",
"[class.ant-select-rtl]": `dir() === 'rtl'`,
"(click)": "onTriggerClick()",
"(mouseenter)": "onTriggerMouseEnter()",
"(mouseleave)": "onTriggerMouseLeave($event)"
},
hostDirectives: [NzSpaceCompactItemDirective],
imports: [
NgTemplateOutlet,
SlicePipe,
OverlayModule,
FormsModule,
NzIconModule,
NzEmptyModule,
NzFormItemFeedbackIconComponent,
NzOverlayModule,
NzNoAnimationDirective,
NzSelectClearComponent,
NzSelectItemComponent,
NzSelectPlaceholderComponent,
NzSelectSearchComponent,
NzCascaderOptionComponent,
NzStringTemplateOutletDirective,
NzDisplayRenderPipe,
NzDisplayRenderContextPipe
]
}]
}],
ctorParameters: () => [],
propDecorators: {
selectContainer: [{
type: ViewChild,
args: ["selectContainer", { static: false }]
}],
input: [{
type: ViewChild,
args: [NzSelectSearchComponent]
}],
menu: [{
type: ViewChild,
args: ["menu", { static: false }]
}],
overlay: [{
type: ViewChild,
args: [CdkConnectedOverlay, { static: false }]
}],
cascaderItems: [{
type: ViewChildren,
args: [NzCascaderOptionComponent]
}],
nzOpen: [{ type: Input }],
nzOptions: [{ type: Input }],
nzOptionRender: [{ type: Input }],
nzShowInput: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzShowArrow: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzAllowClear: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzAutoFocus: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzChangeOnSelect: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzDisabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzColumnClassName: [{ type: Input }],
nzExpandTrigger: [{ type: Input }],
nzValueProperty: [{ type: Input }],
nzLabelProperty: [{ type: Input }],
nzLabelRender: [{ type: Input }],
nzVariant: [{ type: Input }],
nzNotFoundContent: [{ type: Input }],
nzSize: [{ type: Input }],
nzBackdrop: [{ type: Input }],
nzShowSearch: [{ type: Input }],
nzPlaceHolder: [{ type: Input }],
nzMenuClassName: [{ type: Input }],
nzMenuStyle: [{ type: Input }],
nzMouseLeaveDelay: [{
type: Input,
args: [{ transform: numberAttribute }]
}],
nzMouseEnterDelay: [{
type: Input,
args: [{ transform: numberAttribute }]
}],
nzStatus: [{ type: Input }],
nzMultiple: [{
type: Input,
args: [{ transform: booleanAttribute }]
}],
nzMaxTagCount: [{ type: Input }],
nzPlacement: [{ type: Input }],
nzTriggerAction: [{ type: Input }],
nzChangeOn: [{ type: Input }],
nzLoadData: [{ type: Input }],
nzPrefix: [{ type: Input }],
nzSuffixIcon: [{ type: Input }],
nzExpandIcon: [{ type: Input }],
nzPopupRender: [{ type: Input }],
nzVisibleChange: [{ type: Output }],
nzOpenChange: [{
type: i0.Output,
args: ["nzOpenChange"]
}],
nzSelectionChange: [{ type: Output }],
nzRemoved: [{ type: Output }],
nzClear: [{ type: Output }]
}
});
var NzCascaderModule = class NzCascaderModule {
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderModule,
deps: [],
target: i0.ɵɵFactoryTarget.NgModule
});
static ɵmod = i0.ɵɵngDeclareNgModule({
minVersion: "14.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderModule,
imports: [NzCascaderComponent],
exports: [NzCascaderComponent]
});
static ɵinj = i0.ɵɵngDeclareInjector({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderModule,
imports: [NzCascaderComponent]
});
};
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "22.2.2",
ngImport: i0,
type: NzCascaderModule,
decorators: [{
type: NgModule,
args: [{
imports: [NzCascaderComponent],
exports: [NzCascaderComponent]
}]
}]
});
export { NzCascaderComponent, NzCascaderModule, NzCascaderOptionComponent, NzCascaderService, isChildNode, isParentNode, isShowSearchObject };
//# sourceMappingURL=ng-zorro-antd-cascader.mjs.map