UNPKG

ng-zorro-antd-yj

Version:

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

548 lines 36.9 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ export function NzTreeNodeOptions() { } if (false) { /** @type {?} */ NzTreeNodeOptions.prototype.title; /** @type {?} */ NzTreeNodeOptions.prototype.key; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.icon; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.isLeaf; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.checked; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.selected; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.selectable; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.disabled; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.disableCheckbox; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.expanded; /** @type {?|undefined} */ NzTreeNodeOptions.prototype.children; /* Skipping unhandled member: [key: string]: any;*/ } export class NzTreeNode { /** * @param {?} option * @param {?=} parent * @param {?=} service */ constructor(option, parent = null, service = null) { this.level = 0; if (option instanceof NzTreeNode) { return option; } this.service = service || null; this.origin = option; this.key = option.key || ''; this.parentNode = parent; this._title = option.title || '---'; this._icon = option.icon || ''; this._isLeaf = option.isLeaf || false; this._children = []; // option params this._isChecked = option.checked || false; this._isSelectable = option.disabled || (option.selectable === false ? false : true); this._isDisabled = option.disabled || false; this._isDisableCheckbox = option.disableCheckbox || false; this._isExpanded = option.isLeaf ? false : option.expanded || false; this._isHalfChecked = false; this._isSelected = (!option.disabled && option.selected) || false; this._isLoading = false; this.isMatched = false; /** * parent's checked status will affect children while initializing */ if (parent) { this.level = parent.level + 1; } else { this.level = 0; } if (typeof option.children !== 'undefined' && option.children !== null) { option.children.forEach((/** * @param {?} nodeOptions * @return {?} */ nodeOptions => { /** @type {?} */ const s = this.treeService; if (s && !s.isCheckStrictly && option.checked && !option.disabled && !nodeOptions.disabled && !nodeOptions.disableCheckbox) { nodeOptions.checked = option.checked; } this._children.push(new NzTreeNode(nodeOptions, this)); })); } } /** * @return {?} */ get treeService() { return this.service || (this.parentNode && this.parentNode.treeService); } /** * auto generate * get * set * @return {?} */ get title() { return this._title; } /** * @param {?} value * @return {?} */ set title(value) { this._title = value; this.update(); } /** * @return {?} */ get icon() { return this._icon; } /** * @param {?} value * @return {?} */ set icon(value) { this._icon = value; this.update(); } /** * @return {?} */ get children() { return this._children; } /** * @param {?} value * @return {?} */ set children(value) { this._children = value; this.update(); } /** * @return {?} */ get isLeaf() { return this._isLeaf; } /** * @param {?} value * @return {?} */ set isLeaf(value) { this._isLeaf = value; // this.update(); } /** * @return {?} */ get isChecked() { return this._isChecked; } /** * @param {?} value * @return {?} */ set isChecked(value) { this._isChecked = value; this._isAllChecked = value; this.origin.checked = value; this.afterValueChange('isChecked'); } /** * @return {?} */ get isAllChecked() { return this._isAllChecked; } /** * @deprecated Maybe removed in next major version, use isChecked instead * @param {?} value * @return {?} */ set isAllChecked(value) { this._isAllChecked = value; } /** * @return {?} */ get isHalfChecked() { return this._isHalfChecked; } /** * @param {?} value * @return {?} */ set isHalfChecked(value) { this._isHalfChecked = value; this.afterValueChange('isHalfChecked'); } /** * @return {?} */ get isSelectable() { return this._isSelectable; } /** * @param {?} value * @return {?} */ set isSelectable(value) { this._isSelectable = value; this.update(); } /** * @return {?} */ get isDisabled() { return this._isDisabled; } /** * @param {?} value * @return {?} */ set isDisabled(value) { this._isDisabled = value; this.update(); } /** * @return {?} */ get isDisableCheckbox() { return this._isDisableCheckbox; } /** * @param {?} value * @return {?} */ set isDisableCheckbox(value) { this._isDisableCheckbox = value; this.update(); } /** * @return {?} */ get isExpanded() { return this._isExpanded; } /** * @param {?} value * @return {?} */ set isExpanded(value) { this._isExpanded = value; this.origin.expanded = value; this.afterValueChange('isExpanded'); } /** * @return {?} */ get isSelected() { return this._isSelected; } /** * @param {?} value * @return {?} */ set isSelected(value) { this._isSelected = value; this.origin.selected = value; this.afterValueChange('isSelected'); } /** * @return {?} */ get isLoading() { return this._isLoading; } /** * @param {?} value * @return {?} */ set isLoading(value) { this._isLoading = value; this.update(); } /** * @param {?=} checked * @param {?=} halfChecked * @return {?} */ setSyncChecked(checked = false, halfChecked = false) { this.setChecked(checked, halfChecked); if (this.treeService && !this.treeService.isCheckStrictly) { this.treeService.conduct(this); } } /** * @deprecated Maybe removed in next major version, use isChecked instead * @param {?=} checked * @param {?=} halfChecked * @return {?} */ setChecked(checked = false, halfChecked = false) { this.origin.checked = checked; this.isChecked = checked; this.isAllChecked = checked; this.isHalfChecked = halfChecked; } /** * @deprecated Maybe removed in next major version, use isExpanded instead * @param {?} value * @return {?} */ setExpanded(value) { this.isExpanded = value; } /** * @deprecated Maybe removed in next major version, use isSelected instead * @param {?} value * @return {?} */ setSelected(value) { if (this.isDisabled) { return; } this.isSelected = value; } /** * @return {?} */ getParentNode() { return this.parentNode; } /** * @return {?} */ getChildren() { return this.children; } /** * 支持按索引位置插入,叶子节点不可添加 * @param {?} children * @param {?=} childPos * @return {?} */ // tslint:disable-next-line:no-any addChildren(children, childPos = -1) { if (!this.isLeaf) { children.forEach((/** * @param {?} node * @return {?} */ node => { /** @type {?} */ const refreshLevel = (/** * @param {?} n * @return {?} */ (n) => { n.getChildren().forEach((/** * @param {?} c * @return {?} */ c => { c.level = (/** @type {?} */ (c.getParentNode())).level + 1; // flush origin c.origin.level = c.level; refreshLevel(c); })); }); /** @type {?} */ let child = node; if (child instanceof NzTreeNode) { child.parentNode = this; } else { child = new NzTreeNode(node, this); } child.level = this.level + 1; child.origin.level = child.level; refreshLevel(child); try { childPos === -1 ? this.children.push(child) : this.children.splice(childPos, 0, child); // flush origin } catch (e) { } })); this.origin.children = this.getChildren().map((/** * @param {?} v * @return {?} */ v => v.origin)); // remove loading state this.isLoading = false; } } /** * @return {?} */ clearChildren() { // refresh checked state this.afterValueChange('clearChildren'); this.children = []; this.origin.children = []; } /** * @return {?} */ remove() { /** @type {?} */ const parentNode = this.getParentNode(); if (parentNode) { parentNode.children = parentNode.getChildren().filter((/** * @param {?} v * @return {?} */ v => v.key !== this.key)); parentNode.origin.children = (/** @type {?} */ (parentNode.origin.children)).filter((/** * @param {?} v * @return {?} */ v => v.key !== this.key)); this.afterValueChange('remove'); } } /** * @param {?} key * @return {?} */ afterValueChange(key) { if (this.treeService) { switch (key) { case 'isChecked': this.treeService.setCheckedNodeList(this); break; case 'isHalfChecked': this.treeService.setHalfCheckedNodeList(this); break; case 'isExpanded': this.treeService.setExpandedNodeList(this); break; case 'isSelected': this.treeService.setNodeActive(this); break; case 'clearChildren': this.treeService.afterRemove(this.getChildren()); break; case 'remove': this.treeService.afterRemove([this]); break; } } this.update(); } /** * @return {?} */ update() { if (this.component) { this.component.setClassMap(); this.component.markForCheck(); } } } if (false) { /** * @type {?} * @private */ NzTreeNode.prototype._title; /** @type {?} */ NzTreeNode.prototype.key; /** @type {?} */ NzTreeNode.prototype.level; /** @type {?} */ NzTreeNode.prototype.origin; /** @type {?} */ NzTreeNode.prototype.parentNode; /** * @type {?} * @private */ NzTreeNode.prototype._icon; /** * @type {?} * @private */ NzTreeNode.prototype._children; /** * @type {?} * @private */ NzTreeNode.prototype._isLeaf; /** * @type {?} * @private */ NzTreeNode.prototype._isChecked; /** * @deprecated Maybe removed in next major version, use isChecked instead * @type {?} * @private */ NzTreeNode.prototype._isAllChecked; /** * @type {?} * @private */ NzTreeNode.prototype._isSelectable; /** * @type {?} * @private */ NzTreeNode.prototype._isDisabled; /** * @type {?} * @private */ NzTreeNode.prototype._isDisableCheckbox; /** * @type {?} * @private */ NzTreeNode.prototype._isExpanded; /** * @type {?} * @private */ NzTreeNode.prototype._isHalfChecked; /** * @type {?} * @private */ NzTreeNode.prototype._isSelected; /** * @type {?} * @private */ NzTreeNode.prototype._isLoading; /** @type {?} */ NzTreeNode.prototype.isMatched; /** @type {?} */ NzTreeNode.prototype.service; /** @type {?} */ NzTreeNode.prototype.component; } //# sour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