ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
3,874 lines • 113 kB
JavaScript
import { animate, state, style, transition, trigger } from '@angular/animations';
import { __decorate, __metadata } from 'tslib';
import { coerceBooleanProperty, coerceCssPixelValue, _isNumberValue, coerceElement } from '@angular/cdk/coercion';
import { CdkConnectedOverlay, ConnectionPositionPair } from '@angular/cdk/overlay';
import { CommonModule, DOCUMENT } from '@angular/common';
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
import { Platform, PlatformModule } from '@angular/cdk/platform';
import { Subject, merge, BehaviorSubject } from 'rxjs';
import { Directive, ElementRef, Input, Renderer2, TemplateRef, ViewContainerRef, NgModule, Inject, Optional, Injectable, SkipSelf, Type, RendererFactory2, EventEmitter, NgZone, InjectionToken, defineInjectable, inject } from '@angular/core';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzClassListAddDirective {
/**
* @param {?} elementRef
* @param {?} renderer
*/
constructor(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.classList = [];
}
/**
* @param {?} list
* @return {?}
*/
set nzClassListAdd(list) {
this.classList.forEach((/**
* @param {?} name
* @return {?}
*/
name => {
this.renderer.removeClass(this.elementRef.nativeElement, name);
}));
list.forEach((/**
* @param {?} name
* @return {?}
*/
name => {
this.renderer.addClass(this.elementRef.nativeElement, name);
}));
this.classList = list;
}
}
NzClassListAddDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzClassListAdd]',
exportAs: 'nzClassListAdd'
},] }
];
/** @nocollapse */
NzClassListAddDirective.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 }
];
NzClassListAddDirective.propDecorators = {
nzClassListAdd: [{ type: Input }]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzStringTemplateOutletDirective {
/**
* @param {?} viewContainer
* @param {?} defaultTemplate
*/
constructor(viewContainer, defaultTemplate) {
this.viewContainer = viewContainer;
this.defaultTemplate = defaultTemplate;
this.inputTemplate = null;
this.inputViewRef = null;
this.defaultViewRef = null;
}
/**
* @param {?} value
* @return {?}
*/
set nzStringTemplateOutlet(value) {
if (value instanceof TemplateRef) {
this.isTemplate = true;
this.inputTemplate = value;
}
else {
this.isTemplate = false;
}
this.updateView();
}
/**
* @return {?}
*/
updateView() {
if (!this.isTemplate) {
/** use default template when input is string **/
if (!this.defaultViewRef) {
this.viewContainer.clear();
this.inputViewRef = null;
if (this.defaultTemplate) {
this.defaultViewRef = this.viewContainer.createEmbeddedView(this.defaultTemplate);
}
}
}
else {
/** use input template when input is templateRef **/
if (!this.inputViewRef) {
this.viewContainer.clear();
this.defaultViewRef = null;
if (this.inputTemplate) {
this.inputViewRef = this.viewContainer.createEmbeddedView(this.inputTemplate);
}
}
}
}
}
NzStringTemplateOutletDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzStringTemplateOutlet]',
exportAs: 'nzStringTemplateOutlet'
},] }
];
/** @nocollapse */
NzStringTemplateOutletDirective.ctorParameters = () => [
{ type: ViewContainerRef },
{ type: TemplateRef }
];
NzStringTemplateOutletDirective.propDecorators = {
nzStringTemplateOutlet: [{ type: Input }]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzAddOnModule {
}
NzAddOnModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule],
exports: [NzStringTemplateOutletDirective, NzClassListAddDirective],
declarations: [NzStringTemplateOutletDirective, NzClassListAddDirective]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class AnimationDuration {
}
AnimationDuration.SLOW = '0.3s'; // Modal
// Modal
AnimationDuration.BASE = '0.2s';
AnimationDuration.FAST = '0.1s'; // Tooltip
class AnimationCurves {
}
AnimationCurves.EASE_BASE_OUT = 'cubic-bezier(0.7, 0.3, 0.1, 1)';
AnimationCurves.EASE_BASE_IN = 'cubic-bezier(0.9, 0, 0.3, 0.7)';
AnimationCurves.EASE_OUT = 'cubic-bezier(0.215, 0.61, 0.355, 1)';
AnimationCurves.EASE_IN = 'cubic-bezier(0.55, 0.055, 0.675, 0.19)';
AnimationCurves.EASE_IN_OUT = 'cubic-bezier(0.645, 0.045, 0.355, 1)';
AnimationCurves.EASE_OUT_BACK = 'cubic-bezier(0.12, 0.4, 0.29, 1.46)';
AnimationCurves.EASE_IN_BACK = 'cubic-bezier(0.71, -0.46, 0.88, 0.6)';
AnimationCurves.EASE_IN_OUT_BACK = 'cubic-bezier(0.71, -0.46, 0.29, 1.46)';
AnimationCurves.EASE_OUT_CIRC = 'cubic-bezier(0.08, 0.82, 0.17, 1)';
AnimationCurves.EASE_IN_CIRC = 'cubic-bezier(0.6, 0.04, 0.98, 0.34)';
AnimationCurves.EASE_IN_OUT_CIRC = 'cubic-bezier(0.78, 0.14, 0.15, 0.86)';
AnimationCurves.EASE_OUT_QUINT = 'cubic-bezier(0.23, 1, 0.32, 1)';
AnimationCurves.EASE_IN_QUINT = 'cubic-bezier(0.755, 0.05, 0.855, 0.06)';
AnimationCurves.EASE_IN_OUT_QUINT = 'cubic-bezier(0.86, 0, 0.07, 1)';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const collapseMotion = trigger('collapseMotion', [
state('expanded', style({ height: '*' })),
state('collapsed', style({ height: 0, overflow: 'hidden' })),
state('hidden', style({ height: 0, display: 'none' })),
transition('expanded => collapsed', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`)),
transition('expanded => hidden', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`)),
transition('collapsed => expanded', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`)),
transition('hidden => expanded', animate(`150ms ${AnimationCurves.EASE_IN_OUT}`))
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const fadeMotion = trigger('fadeMotion', [
transition(':enter', [style({ opacity: 0 }), animate(`${AnimationDuration.BASE}`, style({ opacity: 1 }))]),
transition(':leave', [style({ opacity: 1 }), animate(`${AnimationDuration.BASE}`, style({ opacity: 0 }))])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const helpMotion = trigger('helpMotion', [
transition(':enter', [
style({
opacity: 0,
transform: 'translateY(-5px)'
}),
animate(`${AnimationDuration.SLOW} ${AnimationCurves.EASE_IN_OUT}`, style({
opacity: 1,
transform: 'translateY(0)'
}))
]),
transition(':leave', [
style({
opacity: 1,
transform: 'translateY(0)'
}),
animate(`${AnimationDuration.SLOW} ${AnimationCurves.EASE_IN_OUT}`, style({
opacity: 0,
transform: 'translateY(-5px)'
}))
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const moveUpMotion = trigger('moveUpMotion', [
transition('* => enter', [
style({
transformOrigin: '0 0',
transform: 'translateY(-100%)',
opacity: 0
}),
animate(`${AnimationDuration.BASE}`, style({
transformOrigin: '0 0',
transform: 'translateY(0%)',
opacity: 1
}))
]),
transition('* => leave', [
style({
transformOrigin: '0 0',
transform: 'translateY(0%)',
opacity: 1
}),
animate(`${AnimationDuration.BASE}`, style({
transformOrigin: '0 0',
transform: 'translateY(-100%)',
opacity: 0
}))
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const notificationMotion = trigger('notificationMotion', [
state('enterRight', style({ opacity: 1, transform: 'translateX(0)' })),
transition('* => enterRight', [style({ opacity: 0, transform: 'translateX(5%)' }), animate('100ms linear')]),
state('enterLeft', style({ opacity: 1, transform: 'translateX(0)' })),
transition('* => enterLeft', [style({ opacity: 0, transform: 'translateX(-5%)' }), animate('100ms linear')]),
state('leave', style({
opacity: 0,
transform: 'scaleY(0.8)',
transformOrigin: '0% 0%'
})),
transition('* => leave', [
style({
opacity: 1,
transform: 'scaleY(1)',
transformOrigin: '0% 0%'
}),
animate('100ms linear')
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const ANIMATION_TRANSITION_IN = `${AnimationDuration.BASE} ${AnimationCurves.EASE_OUT_QUINT}`;
/** @type {?} */
const ANIMATION_TRANSITION_OUT = `${AnimationDuration.BASE} ${AnimationCurves.EASE_IN_QUINT}`;
/** @type {?} */
const slideMotion = trigger('slideMotion', [
state('bottom', style({
opacity: 1,
transform: 'scaleY(1)',
transformOrigin: '0% 0%'
})),
state('top', style({
opacity: 1,
transform: 'scaleY(1)',
transformOrigin: '0% 100%'
})),
transition('void => bottom', [
style({
opacity: 0,
transform: 'scaleY(0.8)',
transformOrigin: '0% 0%'
}),
animate(ANIMATION_TRANSITION_IN)
]),
transition('bottom => void', [
animate(ANIMATION_TRANSITION_OUT, style({
opacity: 0,
transform: 'scaleY(0.8)',
transformOrigin: '0% 0%'
}))
]),
transition('void => top', [
style({
opacity: 0,
transform: 'scaleY(0.8)',
transformOrigin: '0% 100%'
}),
animate(ANIMATION_TRANSITION_IN)
]),
transition('top => void', [
animate(ANIMATION_TRANSITION_OUT, style({
opacity: 0,
transform: 'scaleY(0.8)',
transformOrigin: '0% 100%'
}))
])
]);
/** @type {?} */
const slideAlertMotion = trigger('slideAlertMotion', [
transition(':leave', [
style({ opacity: 1, transform: 'scaleY(1)', transformOrigin: '0% 0%' }),
animate(`${AnimationDuration.SLOW} ${AnimationCurves.EASE_IN_OUT_CIRC}`, style({
opacity: 0,
transform: 'scaleY(0)',
transformOrigin: '0% 0%'
}))
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const zoomMotion = trigger('zoomMotion', [
transition(':enter', [
style({ opacity: 0, transform: 'scale(0.2)' }),
animate(`${AnimationDuration.BASE} ${AnimationCurves.EASE_OUT_CIRC}`, style({
opacity: 1,
transform: 'scale(1)'
}))
]),
transition(':leave', [
style({ opacity: 1, transform: 'scale(1)' }),
animate(`${AnimationDuration.BASE} ${AnimationCurves.EASE_IN_OUT_CIRC}`, style({
opacity: 0,
transform: 'scale(0.2)'
}))
])
]);
/** @type {?} */
const zoomBigMotion = trigger('zoomBigMotion', [
transition('void => active', [
style({ opacity: 0, transform: 'scale(0.8)' }),
animate(`${AnimationDuration.BASE} ${AnimationCurves.EASE_OUT_CIRC}`, style({
opacity: 1,
transform: 'scale(1)'
}))
]),
transition('active => void', [
style({ opacity: 1, transform: 'scale(1)' }),
animate(`${AnimationDuration.BASE} ${AnimationCurves.EASE_IN_OUT_CIRC}`, style({
opacity: 0,
transform: 'scale(0.8)'
}))
])
]);
/** @type {?} */
const zoomBadgeMotion = trigger('zoomBadgeMotion', [
transition(':enter', [
style({ opacity: 0, transform: 'scale(0) translate(50%, -50%)' }),
animate(`${AnimationDuration.SLOW} ${AnimationCurves.EASE_OUT_BACK}`, style({
opacity: 1,
transform: 'scale(1) translate(50%, -50%)'
}))
]),
transition(':leave', [
style({ opacity: 1, transform: 'scale(1) translate(50%, -50%)' }),
animate(`${AnimationDuration.SLOW} ${AnimationCurves.EASE_IN_BACK}`, style({
opacity: 0,
transform: 'scale(0) translate(50%, -50%)'
}))
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} value
* @return {?}
*/
function toBoolean(value) {
return coerceBooleanProperty(value);
}
/**
* @param {?} value
* @param {?=} fallbackValue
* @return {?}
*/
function toNumber(value, fallbackValue = 0) {
return _isNumberValue(value) ? Number(value) : fallbackValue;
}
/**
* @param {?} value
* @return {?}
*/
function toCssPixel(value) {
return coerceCssPixelValue(value);
}
/**
* Get the function-property type's value
* @template T
* @param {?} prop
* @param {...?} args
* @return {?}
*/
// tslint:disable-next-line: no-any
function valueFunctionProp(prop, ...args) {
return typeof prop === 'function' ? prop(...args) : prop;
}
// tslint:disable-next-line: no-any
/**
* @template T, D
* @param {?} name
* @param {?} fallback
* @return {?}
*/
function propDecoratorFactory(name, fallback) {
// tslint:disable-next-line: no-any
/**
* @param {?} target
* @param {?} propName
* @return {?}
*/
function propDecorator(target, propName) {
/** @type {?} */
const privatePropName = `$$__${propName}`;
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
console.warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
}
Object.defineProperty(target, privatePropName, {
configurable: true,
writable: true
});
Object.defineProperty(target, propName, {
/**
* @return {?}
*/
get() {
return this[privatePropName]; // tslint:disable-line:no-invalid-this
},
/**
* @param {?} value
* @return {?}
*/
set(value) {
this[privatePropName] = fallback(value); // tslint:disable-line:no-invalid-this
}
});
}
return propDecorator;
}
/**
* Input decorator that handle a prop to do get/set automatically with toBoolean
*
* Why not using \@InputBoolean alone without \@Input? AOT needs \@Input to be visible
*
* \@howToUse
* ```
* \@Input() \@InputBoolean() visible: boolean = false;
*
* // Act as below:
* // \@Input()
* // get visible() { return this.__visible; }
* // set visible(value) { this.__visible = value; }
* // __visible = false;
* ```
* @return {?}
*/
// tslint:disable-next-line: no-any
function InputBoolean() {
return propDecoratorFactory('InputBoolean', toBoolean);
}
// tslint:disable-next-line: no-any
/**
* @return {?}
*/
function InputCssPixel() {
return propDecoratorFactory('InputCssPixel', toCssPixel);
}
// tslint:disable-next-line: no-any
/**
* @return {?}
*/
function InputNumber() {
// tslint:disable-line: no-any
return propDecoratorFactory('InputNumber', toNumber);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const DISABLED_CLASSNAME = 'nz-animate-disabled';
class NzNoAnimationDirective {
/**
* @param {?} element
* @param {?} renderer
* @param {?} animationType
*/
constructor(element, renderer, animationType) {
this.element = element;
this.renderer = renderer;
this.animationType = animationType;
this.nzNoAnimation = false;
}
/**
* @return {?}
*/
ngOnChanges() {
this.updateClass();
}
/**
* @return {?}
*/
ngAfterViewInit() {
this.updateClass();
}
/**
* @private
* @return {?}
*/
updateClass() {
/** @type {?} */
const element = coerceElement(this.element);
if (!element) {
return;
}
if (this.nzNoAnimation || this.animationType === 'NoopAnimations') {
this.renderer.addClass(element, DISABLED_CLASSNAME);
}
else {
this.renderer.removeClass(element, DISABLED_CLASSNAME);
}
}
}
NzNoAnimationDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzNoAnimation]',
exportAs: 'nzNoAnimation',
host: {
'[@.disabled]': 'nzNoAnimation'
}
},] }
];
/** @nocollapse */
NzNoAnimationDirective.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 },
{ type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
];
NzNoAnimationDirective.propDecorators = {
nzNoAnimation: [{ type: Input }]
};
__decorate([
InputBoolean(),
__metadata("design:type", Boolean)
], NzNoAnimationDirective.prototype, "nzNoAnimation", void 0);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzNoAnimationModule {
}
NzNoAnimationModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzNoAnimationDirective],
exports: [NzNoAnimationDirective],
imports: [CommonModule]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzConnectedOverlayDirective {
/**
* @param {?} cdkConnectedOverlay
*/
constructor(cdkConnectedOverlay) {
this.cdkConnectedOverlay = cdkConnectedOverlay;
this.cdkConnectedOverlay.backdropClass = 'nz-overlay-transparent-backdrop';
}
}
NzConnectedOverlayDirective.decorators = [
{ type: Directive, args: [{
selector: '[cdkConnectedOverlay][nzConnectedOverlay]',
exportAs: 'nzConnectedOverlay'
},] }
];
/** @nocollapse */
NzConnectedOverlayDirective.ctorParameters = () => [
{ type: CdkConnectedOverlay }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzOverlayModule {
}
NzOverlayModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzConnectedOverlayDirective],
exports: [NzConnectedOverlayDirective]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const POSITION_MAP = {
top: new ConnectionPositionPair({ originX: 'center', originY: 'top' }, {
overlayX: 'center',
overlayY: 'bottom'
}),
topCenter: new ConnectionPositionPair({ originX: 'center', originY: 'top' }, { overlayX: 'center', overlayY: 'bottom' }),
topLeft: new ConnectionPositionPair({ originX: 'start', originY: 'top' }, {
overlayX: 'start',
overlayY: 'bottom'
}),
topRight: new ConnectionPositionPair({ originX: 'end', originY: 'top' }, { overlayX: 'end', overlayY: 'bottom' }),
right: new ConnectionPositionPair({ originX: 'end', originY: 'center' }, {
overlayX: 'start',
overlayY: 'center'
}),
rightTop: new ConnectionPositionPair({ originX: 'end', originY: 'top' }, { overlayX: 'start', overlayY: 'top' }),
rightBottom: new ConnectionPositionPair({ originX: 'end', originY: 'bottom' }, { overlayX: 'start', overlayY: 'bottom' }),
bottom: new ConnectionPositionPair({ originX: 'center', originY: 'bottom' }, {
overlayX: 'center',
overlayY: 'top'
}),
bottomCenter: new ConnectionPositionPair({ originX: 'center', originY: 'bottom' }, { overlayX: 'center', overlayY: 'top' }),
bottomLeft: new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }),
bottomRight: new ConnectionPositionPair({ originX: 'end', originY: 'bottom' }, { overlayX: 'end', overlayY: 'top' }),
left: new ConnectionPositionPair({ originX: 'start', originY: 'center' }, {
overlayX: 'end',
overlayY: 'center'
}),
leftTop: new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'end', overlayY: 'top' }),
leftBottom: new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'end', overlayY: 'bottom' })
};
/** @type {?} */
const DEFAULT_TOOLTIP_POSITIONS = [POSITION_MAP.top, POSITION_MAP.right, POSITION_MAP.bottom, POSITION_MAP.left];
/** @type {?} */
const DEFAULT_DROPDOWN_POSITIONS = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
POSITION_MAP.topLeft,
POSITION_MAP.topRight
];
/** @type {?} */
const DEFAULT_SUBMENU_POSITIONS = [POSITION_MAP.rightTop, POSITION_MAP.leftTop];
/** @type {?} */
const DEFAULT_CASCADER_POSITIONS = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
POSITION_MAP.topLeft,
POSITION_MAP.topRight
];
/** @type {?} */
const DEFAULT_MENTION_POSITIONS = [
POSITION_MAP.bottomLeft,
new ConnectionPositionPair({
originX: 'start',
originY: 'bottom'
}, { overlayX: 'start', overlayY: 'bottom' })
];
/**
* @param {?} position
* @return {?}
*/
function getPlacementName(position) {
/** @type {?} */
const keyList = ['originX', 'originY', 'overlayX', 'overlayY'];
for (const placement in POSITION_MAP) {
// @ts-ignore
if (keyList.every((/**
* @param {?} key
* @return {?}
*/
key => position.connectionPair[key] === POSITION_MAP[placement][key]))) {
return placement;
}
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// tslint:disable:no-any typedef no-invalid-this
/** @type {?} */
const availablePrefixes = ['moz', 'ms', 'webkit'];
/**
* @return {?}
*/
function requestAnimationFramePolyfill() {
/** @type {?} */
let lastTime = 0;
return (/**
* @param {?} callback
* @return {?}
*/
function (callback) {
/** @type {?} */
const currTime = new Date().getTime();
/** @type {?} */
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
/** @type {?} */
const id = setTimeout((/**
* @return {?}
*/
() => {
callback(currTime + timeToCall);
}), timeToCall);
lastTime = currTime + timeToCall;
return id;
});
}
/**
* @return {?}
*/
function getRequestAnimationFrame() {
if (typeof window === 'undefined') {
return (/**
* @return {?}
*/
() => 0);
}
if (window.requestAnimationFrame) {
// https://github.com/vuejs/vue/issues/4465
return window.requestAnimationFrame.bind(window);
}
/** @type {?} */
const prefix = availablePrefixes.filter((/**
* @param {?} key
* @return {?}
*/
key => `${key}RequestAnimationFrame` in window))[0];
return prefix ? ((/** @type {?} */ (window)))[`${prefix}RequestAnimationFrame`] : requestAnimationFramePolyfill();
}
/**
* @param {?} id
* @return {?}
*/
function cancelRequestAnimationFrame(id) {
if (typeof window === 'undefined') {
return null;
}
if (window.cancelAnimationFrame) {
return window.cancelAnimationFrame(id);
}
/** @type {?} */
const prefix = availablePrefixes.filter((/**
* @param {?} key
* @return {?}
*/
key => `${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window))[0];
return prefix
? (((/** @type {?} */ (window)))[`${prefix}CancelAnimationFrame`] || ((/** @type {?} */ (window)))[`${prefix}CancelRequestAnimationFrame`])
// @ts-ignore
.call(this, id)
: clearTimeout(id);
}
/** @type {?} */
const reqAnimFrame = getRequestAnimationFrame();
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} t
* @param {?} b
* @param {?} c
* @param {?} d
* @return {?}
*/
function easeInOutCubic(t, b, c, d) {
/** @type {?} */
const cc = c - b;
/** @type {?} */
let tt = t / (d / 2);
if (tt < 1) {
return (cc / 2) * tt * tt * tt + b;
}
else {
return (cc / 2) * ((tt -= 2) * tt * tt + 2) + b;
}
}
class NzScrollService {
/* tslint:disable-next-line:no-any */
/**
* @param {?} doc
*/
constructor(doc) {
this.doc = doc;
}
/**
* 设置 `el` 滚动条位置
* @param {?} el
* @param {?=} topValue
* @return {?}
*/
setScrollTop(el, topValue = 0) {
if (el === window) {
this.doc.body.scrollTop = topValue;
(/** @type {?} */ (this.doc.documentElement)).scrollTop = topValue;
}
else {
((/** @type {?} */ (el))).scrollTop = topValue;
}
}
/**
* 获取 `el` 相对于视窗距离
* @param {?} el
* @return {?}
*/
getOffset(el) {
/** @type {?} */
const ret = {
top: 0,
left: 0
};
if (!el || !el.getClientRects().length) {
return ret;
}
/** @type {?} */
const rect = el.getBoundingClientRect();
if (rect.width || rect.height) {
/** @type {?} */
const doc = (/** @type {?} */ (el.ownerDocument)).documentElement;
ret.top = rect.top - (/** @type {?} */ (doc)).clientTop;
ret.left = rect.left - (/** @type {?} */ (doc)).clientLeft;
}
else {
ret.top = rect.top;
ret.left = rect.left;
}
return ret;
}
/**
* 获取 `el` 滚动条位置
* @param {?=} el
* @param {?=} top
* @return {?}
*/
// TODO: remove '| Window' as the fallback already happens here
getScroll(el, top = true) {
/** @type {?} */
const target = el ? el : window;
/** @type {?} */
const prop = top ? 'pageYOffset' : 'pageXOffset';
/** @type {?} */
const method = top ? 'scrollTop' : 'scrollLeft';
/** @type {?} */
const isWindow = target === window;
// @ts-ignore
/** @type {?} */
let ret = isWindow ? target[prop] : target[method];
if (isWindow && typeof ret !== 'number') {
ret = (/** @type {?} */ (this.doc.documentElement))[method];
}
return ret;
}
/**
* 使用动画形式将 `el` 滚动至某位置
*
* @param {?} containerEl 容器,默认 `window`
* @param {?=} targetTopValue 滚动至目标 `top` 值,默认:0,相当于顶部
* @param {?=} easing 动作算法,默认:`easeInOutCubic`
* @param {?=} callback 动画结束后回调
* @return {?}
*/
scrollTo(containerEl, targetTopValue = 0, easing, callback) {
/** @type {?} */
const target = containerEl ? containerEl : window;
/** @type {?} */
const scrollTop = this.getScroll(target);
/** @type {?} */
const startTime = Date.now();
/** @type {?} */
const frameFunc = (/**
* @return {?}
*/
() => {
/** @type {?} */
const timestamp = Date.now();
/** @type {?} */
const time = timestamp - startTime;
this.setScrollTop(target, (easing || easeInOutCubic)(time, scrollTop, targetTopValue, 450));
if (time < 450) {
reqAnimFrame(frameFunc);
}
else {
if (callback) {
callback();
}
}
});
reqAnimFrame(frameFunc);
}
}
NzScrollService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
NzScrollService.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
];
/**
* @param {?} doc
* @param {?} scrollService
* @return {?}
*/
function SCROLL_SERVICE_PROVIDER_FACTORY(doc, scrollService) {
return scrollService || new NzScrollService(doc);
}
/** @type {?} */
const SCROLL_SERVICE_PROVIDER = {
provide: NzScrollService,
useFactory: SCROLL_SERVICE_PROVIDER_FACTORY,
deps: [DOCUMENT, [new Optional(), new SkipSelf(), NzScrollService]]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isNotNil(value) {
return typeof value !== 'undefined' && value !== null;
}
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isNil(value) {
return typeof value === 'undefined' || value === null;
}
/**
* Examine if two objects are shallowly equaled.
* @param {?=} objA
* @param {?=} objB
* @return {?}
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
return false;
}
/** @type {?} */
const keysA = Object.keys(objA);
/** @type {?} */
const keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
/** @type {?} */
const bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
// tslint:disable-next-line:prefer-for-of
for (let idx = 0; idx < keysA.length; idx++) {
/** @type {?} */
const key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
if (objA[key] !== objB[key]) {
return false;
}
}
return true;
}
/**
* @param {?} value
* @return {?}
*/
function isInteger(value) {
return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
}
/**
* @param {?} element
* @return {?}
*/
function isEmpty(element) {
/** @type {?} */
const nodes = element.childNodes;
for (let i = 0; i < nodes.length; i++) {
if (filterNotEmptyNode(nodes.item(i))) {
return false;
}
}
return true;
}
/**
* @param {?} node
* @return {?}
*/
function filterNotEmptyNode(node) {
if (node) {
if (node.nodeType === 1 && ((/** @type {?} */ (node))).outerHTML.toString().trim().length !== 0) {
// ELEMENT_NODE
return node;
}
else if (node.nodeType === 3 && (/** @type {?} */ (node.textContent)).toString().trim().length !== 0) {
// TEXT_NODE
return node;
}
return null;
}
return null;
}
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isNonEmptyString(value) {
return typeof value === 'string' && value !== '';
}
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isTemplateRef(value) {
return value instanceof TemplateRef;
}
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isComponent(value) {
return value instanceof Type;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzMeasureScrollbarService {
// tslint:disable-next-line:no-any
/**
* @param {?} document
*/
constructor(document) {
this.document = document;
this.scrollbarMeasure = {
position: 'absolute',
top: '-9999px',
width: '50px',
height: '50px',
overflow: 'scroll'
};
this.initScrollBarWidth();
}
/**
* @return {?}
*/
get scrollBarWidth() {
if (isNotNil(this._scrollbarWidth)) {
return this._scrollbarWidth;
}
this.initScrollBarWidth();
return this._scrollbarWidth;
}
/**
* @return {?}
*/
initScrollBarWidth() {
/** @type {?} */
const scrollDiv = this.document.createElement('div');
for (const scrollProp in this.scrollbarMeasure) {
if (this.scrollbarMeasure.hasOwnProperty(scrollProp)) {
scrollDiv.style[scrollProp] = this.scrollbarMeasure[scrollProp];
}
}
this.document.body.appendChild(scrollDiv);
/** @type {?} */
const width = scrollDiv.offsetWidth - scrollDiv.clientWidth;
this.document.body.removeChild(scrollDiv);
this._scrollbarWidth = width;
}
}
NzMeasureScrollbarService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
NzMeasureScrollbarService.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
];
/** @nocollapse */ NzMeasureScrollbarService.ngInjectableDef = defineInjectable({ factory: function NzMeasureScrollbarService_Factory() { return new NzMeasureScrollbarService(inject(DOCUMENT)); }, token: NzMeasureScrollbarService, providedIn: "root" });
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzUpdateHostClassService {
/**
* @param {?} rendererFactory2
*/
constructor(rendererFactory2) {
this.classMap = {};
this.renderer = rendererFactory2.createRenderer(null, null);
}
/**
* @param {?} el
* @param {?} classMap
* @return {?}
*/
updateHostClass(el, classMap) {
this.removeClass(el, this.classMap, this.renderer);
this.classMap = Object.assign({}, classMap);
this.addClass(el, this.classMap, this.renderer);
}
/**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
removeClass(el, classMap, renderer) {
for (const i in classMap) {
if (classMap.hasOwnProperty(i)) {
renderer.removeClass(el, i);
}
}
}
/**
* @private
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
addClass(el, classMap, renderer) {
for (const i in classMap) {
if (classMap.hasOwnProperty(i) && classMap[i]) {
renderer.addClass(el, i);
}
}
}
}
NzUpdateHostClassService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
NzUpdateHostClassService.ctorParameters = () => [
{ type: RendererFactory2 }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Creates a browser MouseEvent with the specified options.
* @param {?} type
* @param {?=} x
* @param {?=} y
* @return {?}
*/
function createMouseEvent(type, x = 0, y = 0) {
/** @type {?} */
const event = document.createEvent('MouseEvent');
event.initMouseEvent(type, false /* canBubble */, false /* cancelable */, window /* view */, 0 /* detail */, x /* screenX */, y /* screenY */, x /* clientX */, y /* clientY */, false /* ctrlKey */, false /* altKey */, false /* shiftKey */, false /* metaKey */, 0 /* button */, null /* relatedTarget */);
return event;
}
/**
* Creates a browser TouchEvent with the specified pointer coordinates.
* @param {?} type
* @param {?=} pageX
* @param {?=} pageY
* @return {?}
*/
function createTouchEvent(type, pageX = 0, pageY = 0) {
// In favor of creating events that work for most of the browsers, the event is created
// as a basic UI Event. The necessary details for the event will be set manually.
/** @type {?} */
const event = document.createEvent('UIEvent');
/** @type {?} */
const touchDetails = { pageX, pageY };
event.initUIEvent(type, true, true, window, 0);
// Most of the browsers don't have a "initTouchEvent" method that can be used to define
// the touch details.
Object.defineProperties(event, {
touches: { value: [touchDetails] }
});
return (/** @type {?} */ (event));
}
/**
* Dispatches a keydown event from an element.
* @param {?} type
* @param {?} keyCode
* @param {?=} target
* @param {?=} key
* @return {?}
*/
function createKeyboardEvent(type, keyCode, target, key) {
/** @type {?} */
const event = (/** @type {?} */ (document.createEvent('KeyboardEvent')));
// Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`.
/** @type {?} */
const initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event);
/** @type {?} */
const originalPreventDefault = event.preventDefault;
initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode);
// Webkit Browsers don't set the keyCode when calling the init function.
// See related bug https://bugs.webkit.org/show_bug.cgi?id=16735
Object.defineProperties(event, {
keyCode: { get: (/**
* @return {?}
*/
() => keyCode) },
key: { get: (/**
* @return {?}
*/
() => key) },
target: { get: (/**
* @return {?}
*/
() => target) }
});
// IE won't set `defaultPrevented` on synthetic events so we need to do it manually.
event.preventDefault = (/**
* @return {?}
*/
function () {
Object.defineProperty(event, 'defaultPrevented', { get: (/**
* @return {?}
*/
() => true) });
return originalPreventDefault.apply(this, arguments);
});
return event;
}
/**
* Creates a fake event object with any desired event type.
* @param {?} type
* @param {?=} canBubble
* @param {?=} cancelable
* @return {?}
*/
function createFakeEvent(type, canBubble = true, cancelable = true) {
/** @type {?} */
const event = document.createEvent('Event');
event.initEvent(type, canBubble, cancelable);
return event;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Utility to dispatch any event on a Node.
* @param {?} node
* @param {?} event
* @return {?}
*/
function dispatchEvent(node, event) {
node.dispatchEvent(event);
return event;
}
/**
* Shorthand to dispatch a fake event on a specified node.
* @param {?} node
* @param {?} type
* @param {?=} canBubble
* @return {?}
*/
function dispatchFakeEvent(node, type, canBubble) {
return dispatchEvent(node, createFakeEvent(type, canBubble));
}
/**
* Shorthand to dispatch a keyboard event with a specified key code.
* @param {?} node
* @param {?} type
* @param {?} keyCode
* @param {?=} target
* @return {?}
*/
function dispatchKeyboardEvent(node, type, keyCode, target) {
return (/** @type {?} */ (dispatchEvent(node, createKeyboardEvent(type, keyCode, target))));
}
/**
* Shorthand to dispatch a mouse event on the specified coordinates.
* @param {?} node
* @param {?} type
* @param {?=} x
* @param {?=} y
* @param {?=} event
* @return {?}
*/
function dispatchMouseEvent(node, type, x = 0, y = 0, event = createMouseEvent(type, x, y)) {
return (/** @type {?} */ (dispatchEvent(node, event)));
}
/**
* Shorthand to dispatch a touch event on the specified coordinates.
* @param {?} node
* @param {?} type
* @param {?=} x
* @param {?=} y
* @return {?}
*/
function dispatchTouchEvent(node, type, x = 0, y = 0) {
return (/** @type {?} */ (dispatchEvent(node, createTouchEvent(type, x, y))));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Focuses an input, sets its value and dispatches
* the `input` event, simulating the user typing.
* @param {?} value Value to be set on the input.
* @param {?} element Element onto which to set the value.
* @return {?}
*/
function typeInElement(value, element) {
element.focus();
element.value = value;
dispatchFakeEvent(element, 'input');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Gets a RegExp used to detect an angular wrapped error message.
* See https://github.com/angular/angular/issues/8348
* @param {?} e
* @return {?}
*/
function wrappedErrorMessage(e) {
/** @type {?} */
const escapedMessage = e.message.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
return new RegExp(escapedMessage);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@docs-private
*/
class FakeViewportRuler {
/**
* @return {?}
*/
getViewportRect() {
return {
left: 0,
top: 0,
width: 1014,
height: 686,
bottom: 686,
right: 1014
};
}
/**
* @return {?}
*/
getViewportSize() {
return { width: 1014, height: 686 };
}
/**
* @return {?}
*/
getViewportScrollPosition() {
return { top: 0, left: 0 };
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Mock synchronous NgZone implementation that can be used
* to flush out `onStable` subscriptions in tests.
*
* via: https://github.com/angular/angular/blob/master/packages/core/testing/src/ng_zone_mock.ts
* \@docs-private
*/
class MockNgZone extends NgZone {
constructor() {
super({ enableLongStackTrace: false });
this.onStable = new EventEmitter(false);
}
/**
* @param {?} fn
* @return {?}
*/
run(fn) {
return fn();
}
/**
* @param {?} fn
* @return {?}
*/
runOutsideAngular(fn) {
return fn();
}
/**
* @return {?}
*/
simulateZoneExit() {
this.onStable.emit(null);
}
}
MockNgZone.decorators = [
{ type: Injectable }
];
/** @nocollapse */
MockNgZone.ctorParameters = () => [];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
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;
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();
}
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template T
* @param {?} value
* @return {?}
*/
function toArray(value) {
/** @type {?} */
let ret;
if (value == null) {
ret = [];
}
else if (!Array.isArray(value)) {
ret = [value];
}
else {
ret = value;
}
return ret;
}
/**
* @template T
* @param {?} array1
* @param {?} array2
* @return {?}
*/
function arraysEqual(array1, array2) {
if (!array1 || !array2 || array1.length !== array2.length) {
return false;
}
/** @type {?} */
const len = array1.length;
for (let i = 0; i < len; i++) {
if (array1[i] !== array2[i]) {
return false;
}
}
return true;
}
/**
* @template T
* @param {?} source
* @return {?}
*/
function shallowCopyArray(source) {
return source.slice();
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Silent an event by stopping and preventing it.
* @param {?} e
* @return {?}
*/
function silentEvent(e) {
e.stopPropagation();
e.preventDefault();
}
/**
* @param {?} elem
* @return {?}
*/
function getElementOffset(elem) {
if (!elem.getClientRects().length) {
return { top: 0, left: 0 };
}
/** @type {?} */
const rect = elem.getBoundingClientRect();
/** @type {?} */
const win = (/** @type {?} */ (elem.ownerDocument)).defaultView;
return {
top: rect.top + (/** @type {?} */ (win)).pageYOffset,
left: rect.left + (/** @type {?} */ (win)).pageXOffset
};
}
/**
* @param {?} element
* @return {?}
*/
function findFirstNotEmptyNode(element) {
/** @type {?} */
const children = element.childNodes;
for (let i = 0; i < children.length; i++) {
/** @type {?} */
const node = children.item(i);
if (filterNotEmptyNode(node)) {
return node;
}
}
return null;
}
/**
* @param {?} element
* @return {?}
*/
function findLastNotEmptyNode(element) {
/** @type {?} */
const children = element.childNodes;
for (let i = children.length - 1; i >= 0; i--) {
/** @type {?} */
const node = children.item(i);
if (filterNotEmptyNode(node)) {
return node;
}
}
return null;
}
/**
* @param {?} parent
* @return {?}
*/
function reverseChildNodes(parent) {
/** @type {?} */
const children = parent.childNodes;
/** @type {?} */
let length = children.length;
if (length) {
/** @type {?} */
const nodes = [];
children.forEach((/**
* @param {?} node
* @param {?} i
* @return {?}
*/
(node, i) => (nodes[i] = node)));
while (length--) {
parent.appendChild(nodes[length]);
}
}
}
/**
* Investigate if an event is a `TouchEvent`.
* @param {?} event
* @return {?}
*/
function isTouchEvent(event) {
return event.type.startsWith('touch');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} prefix
* @return {?}
*/
function getRegExp(prefix) {
/** @type {?} */
const prefixArray = Array.isArray(prefix) ? prefix : [prefix];
/** @type {?} */
let prefixToken = prefixArray.join('').replace(/(\$|\^)/g, '\\$1');
if (prefixArray.length > 1) {
prefixToken = `[${prefixToken}]`;
}
return new RegExp(`(\\s|^)(${prefixToken})[^\\s]*`, 'g');
}
/**
* @param {?} value
* @param {?=} prefix
* @return {?}
*/
function getMentions(value, prefix = '@') {
if (typeof value !== 'string') {
return [];
}
/** @type {?} */
const regex = getRegExp(prefix);
/** @type {?} */
const mentions = value.match(regex);
return mentions !== null ? mentions.map((/**
* @param {?} e
* @return {?}
*/
e => e.trim())) : [];
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Much like lodash.
* @param {?} toPad
* @param {?} length
* @param {?} element
* @return {?}
*/
function padStart(toPad, length, element) {
if (toPad.length > length) {
return toPad;
}
/** @type {?} */
const joined = `${getRepeatedElement(length, element)}${toPad}`;
return joined.slice(joined.length - length, joined.length);
}
/**
* @param {?} toPad
* @param {?} length
* @param {?} element
* @return {?}
*/
function padEnd(toPad, length, element) {
/** @type {?} */
const joined = `${toPad}${getRepeatedElement(length, element)}`;
return joined.slice(0, length);
}
/**
* @param {?} length
* @param {?} element
* @return {?}
*/
function getRepeatedElement(length, element) {
return Array(length)
.fill(element)
.join('');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// tslint:disable-next-line:no-any
/**
* @param {?} obj
* @return {?}
*/
function isPromise(obj) {
return !!obj && typeof obj.then === 'function' && typeof obj.catch === 'function';
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} min
* @param {?} max
* @param {?} value
* @return {?}
*/
function getPercent(min, max, value) {
return ((value - min) / (max - min)) * 100;
}
/**
* @param {?} num
* @return {?}
*/
function getPrecision(num) {
/** @type {?} */
const numStr = num.toString();
/** @type {?} */
const dotIndex = numStr.indexOf('.');
return dotIndex >= 0 ? numStr.length - dotIndex - 1 : 0;
}
/**
* @param {?} num
* @param {?} min
* @param {?} max
* @return {?}
*/
function ensureNumberInRange(num, min, max) {
if (isNaN(num) || num < min) {
return min;
}
else if (num > max) {
return max;
}
else {
return num;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} node
* @return {?}
*/
function scrollIntoView(node) {
/** @type {?} */
const nodeAsAny = (/** @type {?} */ (node));
if (nodeAsAny.scrollIntoViewIfNeeded) {
/* tslint:disable-next-line:no-string-literal */
nodeAsAny.scrollIntoViewIfNeeded(false);
return;
}
if (node.scrollIntoView) {
node.scrollIntoView(false);
return;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// from https://github.com/component/textarea-caret-position
// We'll copy the properties below into the mirror div.
// Note that some browsers, such as Firefox, do not concatenate properties
// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),
// so we have to list every single property explicitly.
/** @type {?} */
const properties = [
'direction',
'boxSizing',
'width',
'height',
'overflowX',
'overflowY',
'borderTopWidth',
'borderRightWidth',
'borderBottomWidth',
'borderLeftWidth',
'borderStyle',
'paddingTop',
'paddingRight',
'paddingBottom',
'paddingLeft',
// https://developer.mozilla.org/en-US/docs/Web/CSS/font
'fontStyle',
'fontVariant',
'fontWeight',
'fontStretch',
'fontSize',
'fontSizeAdjust',
'lineHeight',
'fontFamily',
'textAlign',
'textTransform',
'textIndent',
'textDecoration',
'letterSpacing',
'wordSpacing',
'tabSize',
'MozTabSize'
];
/** @type {?} */
const isBrowser = typeof window !== 'undefined';
// tslint:disable-next-line:no-any
/** @type {?} */
const isFirefox = isBrowser && ((/** @type {?} */ (window))).mozInnerScreenX != null;
/** @type {?} */
const _parseInt = (/**
* @param {?} str
* @return {?}
*/
(str) => parseInt(str, 10));
/**
* @param {?} element
* @param {?} position
* @param {?=} options
* @return {?}
*/
function getCaretCoordinates(element, position, options) {
if (!isBrowser) {
throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');
}
/** @type {?} */
const debug = (options && options.debug) || false;
if (debug) {
/** @type {?} */
const el = document.querySelector('#input-textarea-caret-position-mirror-div');
if (el) {
(/** @type {?} */ (el.parentNode)).removeChild(el);
}
}
// The mirror div will replicate the textarea's style
/** @type {?} */
const div = document.createElement('div');
div.id = 'input-textarea-caret-position-mirror-div';
document.body.appendChild(div);
/** @type {?} */
const style$$1 = div.style;
// tslint:disable-next-line:no-any
/** @type {?} */
const computed = window.getComputedStyle ? window.getComputedStyle(element) : ((/** @type {?} */ (element))).currentStyle;
// currentStyle for IE < 9
/** @type {?} */
const isInput = element.nodeName === 'INPUT';
// Default textarea styles
style$$1.whiteSpace = 'pre-wrap';
if (!isInput) {
style$$1.wordWrap = 'break-word'; // only for textarea-s
}
// Position off-screen
style$$1.position = 'absolute'; // required to return coordinates properly
if (!debug) {
style$$1.visibility = 'hidden';
} // not 'display: none' because we want rendering
// Transfer the element's properties to the div
properties.forEach((/**
* @param {?} prop
* @return {?}
*/
(prop) => {
if (isInput && prop === 'lineHeight') {
// Special case for <input>s because text is rendered centered and line height may be != height
style$$1.lineHeight = computed.height;
}
else {
// @ts-ignore
style$$1[prop] = computed[prop];
}
}));
if (isFirefox) {
// Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275
if (element.scrollHeight > _parseInt(computed.height)) {
style$$1.overflowY = 'scroll';
}
}
else {
style$$1.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'
}
div.textContent = element.value.substring(0, position);
// The second special handling for input type="text" vs textarea:
// spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037
if (isInput) {
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
}
/** @type {?} */
const span = document.createElement('span');
// Wrapping must be replicated *exactly*, including when a long word gets
// onto the next line, with whitespace at the end of the line before (#7).
// The *only* reliable way to do that is to copy the *entire* rest of the
// textarea's content into the <span> created at the caret position.
// For inputs, just '.' would be enough, but no need to bother.
span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all
div.appendChild(span);
/** @type {?} */
const coordinates = {
top: span.offsetTop + _parseInt(computed.borderTopWidth),
left: span.offsetLeft + _parseInt(computed.borderLeftWidth),
height: _parseInt(computed.lineHeight)
};
if (debug) {
span.style.backgroundColor = '#eee';
createDebugEle(element, coordinates);
}
else {
document.body.removeChild(div);
}
return coordinates;
}
/**
* @param {?} element
* @param {?} coordinates
* @return {?}
*/
function createDebugEle(element, coordinates) {
/** @type {?} */
const fontSize = getComputedStyle(element).getPropertyValue('font-size');
/** @type {?} */
const rect = ((/** @type {?} */ (document.querySelector('#DEBUG')))) || document.createElement('div');
document.body.appendChild(rect);
rect.id = 'DEBUG';
rect.style.position = 'absolute';
rect.style.backgroundColor = 'red';
rect.style.height = fontSize;
rect.style.width = '1px';
rect.style.top = `${element.getBoundingClientRect().top -
element.scrollTop +
window.pageYOffset +
coordinates.top}px`;
rect.style.left = `${element.getBoundingClientRect().left -
element.scrollLeft +
window.pageXOffset +
coordinates.left}px`;
console.log(rect.style.top);
console.log(rect.style.left);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} fn
* @return {?}
*/
function throttleByAnimationFrame(fn) {
/** @type {?} */
let requestId;
/** @type {?} */
const later = (/**
* @param {?} args
* @return {?}
*/
(args) => (/**
* @return {?}
*/
() => {
requestId = null;
fn(...args);
}));
/** @type {?} */
const throttled = (/**
* @param {...?} args
* @return {?}
*/
(...args) => {
if (requestId == null) {
requestId = reqAnimFrame(later(args));
}
});
// tslint:disable-next-line:no-non-null-assertion
((/** @type {?} */ (throttled))).cancel = (/**
* @return {?}
*/
() => cancelRequestAnimationFrame((/** @type {?} */ (requestId))));
return throttled;
}
/**
* @return {?}
*/
function throttleByAnimationFrameDecorator() {
return (/**
* @param {?} target
* @param {?} key
* @param {?} descriptor
* @return {?}
*/
function (target, key, descriptor) {
/** @type {?} */
const fn = descriptor.value;
/** @type {?} */
let definingProperty = false;
return {
configurable: true,
/**
* @return {?}
*/
get() {
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
return fn;
}
/** @type {?} */
const boundFn = throttleByAnimationFrame(fn.bind(this));
definingProperty = true;
Object.defineProperty(this, key, {
value: boundFn,
configurable: true,
writable: true
});
definingProperty = false;
return boundFn;
}
};
});
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const timeUnits = [
['Y', 1000 * 60 * 60 * 24 * 365],
['M', 1000 * 60 * 60 * 24 * 30],
['D', 1000 * 60 * 60 * 24],
['H', 1000 * 60 * 60],
['m', 1000 * 60],
['s', 1000],
['S', 1] // million seconds
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} node
* @return {?}
*/
function isCheckDisabled(node) {
const { isDisabled, isDisableCheckbox } = node;
return !!(isDisabled || isDisableCheckbox);
}
// tslint:disable-next-line:no-any
/**
* @param {?} needle
* @param {?} haystack
* @return {?}
*/
function isInArray(needle, haystack) {
return haystack.length > 0 && haystack.indexOf(needle) > -1;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzTreeBaseService {
constructor() {
this.DRAG_SIDE_RANGE = 0.25;
this.DRAG_MIN_GAP = 2;
this.isCheckStrictly = false;
this.isMultiple = false;
this.rootNodes = [];
this.selectedNodeList = [];
this.expandedNodeList = [];
this.checkedNodeList = [];
this.halfCheckedNodeList = [];
this.matchedNodeList = [];
this.triggerEventChange$ = new Subject();
}
/**
* trigger event
* @return {?}
*/
eventTriggerChanged() {
return this.triggerEventChange$.asObservable();
}
/**
* reset tree nodes will clear default node list
* @param {?} nzNodes
* @return {?}
*/
initTree(nzNodes) {
this.rootNodes = nzNodes;
this.expandedNodeList = [];
this.selectedNodeList = [];
this.halfCheckedNodeList = [];
this.checkedNodeList = [];
this.matchedNodeList = [];
// refresh node checked state
setTimeout((/**
* @return {?}
*/
() => {
this.refreshCheckState(this.isCheckStrictly);
}));
}
/**
* @return {?}
*/
getSelectedNode() {
return this.selectedNode;
}
/**
* get some list
* @return {?}
*/
getSelectedNodeList() {
return this.conductNodeState('select');
}
/**
* return checked nodes
* @return {?}
*/
getCheckedNodeList() {
return this.conductNodeState('check');
}
/**
* @return {?}
*/
getHalfCheckedNodeList() {
return this.conductNodeState('halfCheck');
}
/**
* return expanded nodes
* @return {?}
*/
getExpandedNodeList() {
return this.conductNodeState('expand');
}
/**
* return search matched nodes
* @return {?}
*/
getMatchedNodeList() {
return this.conductNodeState('match');
}
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
isArrayOfNzTreeNode(value) {
return value.every((/**
* @param {?} item
* @return {?}
*/
item => item instanceof NzTreeNode));
}
/**
* reset selectedNodeList
* @param {?} selectedKeys
* @param {?} nzNodes
* @param {?=} isMulti
* @return {?}
*/
calcSelectedKeys(selectedKeys, nzNodes, isMulti = false) {
/** @type {?} */
const calc = (/**
* @param {?} nodes
* @return {?}
*/
(nodes) => {
return nodes.every((/**
* @param {?} node
* @return {?}
*/
node => {
if (isInArray(node.key, selectedKeys)) {
node.isSelected = true;
if (!isMulti) {
// if not support multi select
return false;
}
}
else {
node.isSelected = false;
}
if (node.children.length > 0) {
// Recursion
return calc(node.children);
}
return true;
}));
});
calc(nzNodes);
}
/**
* reset expandedNodeList
* @param {?} expandedKeys
* @param {?} nzNodes
* @return {?}
*/
calcExpandedKeys(expandedKeys, nzNodes) {
this.expandedNodeList = [];
/** @type {?} */
const calc = (/**
* @param {?} nodes
* @return {?}
*/
(nodes) => {
nodes.forEach((/**
* @param {?} node
* @return {?}
*/
node => {
node.isExpanded = isInArray(node.key, expandedKeys);
if (node.children.length > 0) {
calc(node.children);
}
}));
});
calc(nzNodes);
}
/**
* reset checkedNodeList
* @param {?} checkedKeys
* @param {?} nzNodes
* @param {?=} isCheckStrictly
* @return {?}
*/
calcCheckedKeys(checkedKeys, nzNodes, isCheckStrictly = false) {
this.checkedNodeList = [];
this.halfCheckedNodeList = [];
/** @type {?} */
const calc = (/**
* @param {?} nodes
* @return {?}
*/
(nodes) => {
nodes.forEach((/**
* @param {?} node
* @return {?}
*/
node => {
if (isInArray(node.key, checkedKeys)) {
node.isChecked = true;
node.isHalfChecked = false;
}
else {
node.isChecked = false;
node.isHalfChecked = false;
}
if (node.children.length > 0) {
calc(node.children);
}
}));
});
calc(nzNodes);
// controlled state
this.refreshCheckState(isCheckStrictly);
}
/**
* set drag node
* @param {?} node
* @return {?}
*/
setSelectedNode(node) {
this.selectedNode = node;
}
/**
* set node selected status
* @param {?} node
* @return {?}
*/
setNodeActive(node) {
if (!this.isMultiple && node.isSelected) {
this.selectedNodeList.forEach((/**
* @param {?} n
* @return {?}
*/
n => {
if (node.key !== n.key) {
// reset other nodes
n.isSelected = false;
}
}));
// single mode: remove pre node
this.selectedNodeList = [];
}
this.setSelectedNodeList(node, this.isMultiple);
}
/**
* add or remove node to selectedNodeList
* @param {?} node
* @param {?=} isMultiple
* @return {?}
*/
setSelectedNodeList(node, isMultiple = false) {
/** @type {?} */
const index = this.selectedNodeList.findIndex((/**
* @param {?} n
* @return {?}
*/
n => node.key === n.key));
if (isMultiple) {
if (node.isSelected && index === -1) {
this.selectedNodeList.push(node);
}
}
else {
if (node.isSelected && index === -1) {
this.selectedNodeList = [node];
}
}
if (!node.isSelected) {
this.selectedNodeList = this.selectedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== node.key));
}
}
/**
* merge checked nodes
* @param {?} node
* @return {?}
*/
setHalfCheckedNodeList(node) {
/** @type {?} */
const index = this.halfCheckedNodeList.findIndex((/**
* @param {?} n
* @return {?}
*/
n => node.key === n.key));
if (node.isHalfChecked && index === -1) {
this.halfCheckedNodeList.push(node);
}
else if (!node.isHalfChecked && index > -1) {
this.halfCheckedNodeList = this.halfCheckedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => node.key !== n.key));
}
}
/**
* @param {?} node
* @return {?}
*/
setCheckedNodeList(node) {
/** @type {?} */
const index = this.checkedNodeList.findIndex((/**
* @param {?} n
* @return {?}
*/
n => node.key === n.key));
if (node.isChecked && index === -1) {
this.checkedNodeList.push(node);
}
else if (!node.isChecked && index > -1) {
this.checkedNodeList = this.checkedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => node.key !== n.key));
}
}
/**
* conduct checked/selected/expanded keys
* @param {?=} type
* @return {?}
*/
conductNodeState(type = 'check') {
/** @type {?} */
let resultNodesList = [];
switch (type) {
case 'select':
resultNodesList = this.selectedNodeList;
break;
case 'expand':
resultNodesList = this.expandedNodeList;
break;
case 'match':
resultNodesList = this.matchedNodeList;
break;
case 'check':
resultNodesList = this.checkedNodeList;
/** @type {?} */
const isIgnore = (/**
* @param {?} node
* @return {?}
*/
(node) => {
/** @type {?} */
const parentNode = node.getParentNode();
if (parentNode) {
if (this.checkedNodeList.findIndex((/**
* @param {?} n
* @return {?}
*/
n => n.key === parentNode.key)) > -1) {
return true;
}
else {
return isIgnore(parentNode);
}
}
return false;
});
// merge checked
if (!this.isCheckStrictly) {
resultNodesList = this.checkedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => !isIgnore(n)));
}
break;
case 'halfCheck':
if (!this.isCheckStrictly) {
resultNodesList = this.halfCheckedNodeList;
}
break;
}
return resultNodesList;
}
/**
* set expanded nodes
* @param {?} node
* @return {?}
*/
setExpandedNodeList(node) {
if (node.isLeaf) {
return;
}
/** @type {?} */
const index = this.expandedNodeList.findIndex((/**
* @param {?} n
* @return {?}
*/
n => node.key === n.key));
if (node.isExpanded && index === -1) {
this.expandedNodeList.push(node);
}
else if (!node.isExpanded && index > -1) {
this.expandedNodeList = this.expandedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => node.key !== n.key));
}
}
/**
* check state
* @param {?=} isCheckStrictly
* @return {?}
*/
refreshCheckState(isCheckStrictly = false) {
if (isCheckStrictly) {
return;
}
this.checkedNodeList.forEach((/**
* @param {?} node
* @return {?}
*/
node => {
this.conduct(node);
}));
}
// reset other node checked state based current node
/**
* @param {?} node
* @return {?}
*/
conduct(node) {
/** @type {?} */
const isChecked = node.isChecked;
if (node) {
this.conductUp(node);
this.conductDown(node, isChecked);
}
}
/**
* 1、children half checked
* 2、children all checked, parent checked
* 3、no children checked
* @param {?} node
* @return {?}
*/
conductUp(node) {
/** @type {?} */
const parentNode = node.getParentNode();
// 全禁用节点不选中
if (parentNode) {
if (!isCheckDisabled(parentNode)) {
if (parentNode.children.every((/**
* @param {?} child
* @return {?}
*/
child => isCheckDisabled(child) || (!child.isHalfChecked && child.isChecked)))) {
parentNode.isChecked = true;
parentNode.isHalfChecked = false;
}
else if (parentNode.children.some((/**
* @param {?} child
* @return {?}
*/
child => child.isHalfChecked || child.isChecked))) {
parentNode.isChecked = false;
parentNode.isHalfChecked = true;
}
else {
parentNode.isChecked = false;
parentNode.isHalfChecked = false;
}
}
this.setCheckedNodeList(parentNode);
this.setHalfCheckedNodeList(parentNode);
this.conductUp(parentNode);
}
}
/**
* reset child check state
* @param {?} node
* @param {?} value
* @return {?}
*/
conductDown(node, value) {
if (!isCheckDisabled(node)) {
node.isChecked = value;
node.isHalfChecked = false;
this.setCheckedNodeList(node);
this.setHalfCheckedNodeList(node);
node.children.forEach((/**
* @param {?} n
* @return {?}
*/
n => {
this.conductDown(n, value);
}));
}
}
/**
* search value & expand node
* should add expandlist
* @param {?} value
* @return {?}
*/
searchExpand(value) {
this.matchedNodeList = [];
/** @type {?} */
const expandedKeys = [];
if (!isNotNil(value)) {
return;
}
// to reset expandedNodeList
/** @type {?} */
const expandParent = (/**
* @param {?} n
* @return {?}
*/
(n) => {
// expand parent node
/** @type {?} */
const parentNode = n.getParentNode();
if (parentNode) {
expandedKeys.push(parentNode.key);
expandParent(parentNode);
}
});
/** @type {?} */
const searchChild = (/**
* @param {?} n
* @return {?}
*/
(n) => {
if (value && n.title.includes(value)) {
// match the node
n.isMatched = true;
this.matchedNodeList.push(n);
// expand parentNode
expandParent(n);
}
else {
n.isMatched = false;
}
n.children.forEach((/**
* @param {?} child
* @return {?}
*/
child => {
searchChild(child);
}));
});
this.rootNodes.forEach((/**
* @param {?} child
* @return {?}
*/
child => {
searchChild(child);
}));
// expand matched keys
this.calcExpandedKeys(expandedKeys, this.rootNodes);
}
/**
* flush after delete node
* @param {?} nodes
* @return {?}
*/
afterRemove(nodes) {
// to reset selectedNodeList & expandedNodeList
/** @type {?} */
const loopNode = (/**
* @param {?} node
* @return {?}
*/
(node) => {
// remove selected node
this.selectedNodeList = this.selectedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== node.key));
// remove expanded node
this.expandedNodeList = this.expandedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== node.key));
// remove checked node
this.checkedNodeList = this.checkedNodeList.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== node.key));
if (node.children) {
node.children.forEach((/**
* @param {?} child
* @return {?}
*/
child => {
loopNode(child);
}));
}
});
nodes.forEach((/**
* @param {?} n
* @return {?}
*/
n => {
loopNode(n);
}));
this.refreshCheckState(this.isCheckStrictly);
}
/**
* drag event
* @param {?} node
* @return {?}
*/
refreshDragNode(node) {
if (node.children.length === 0) {
// until root
this.conductUp(node);
}
else {
node.children.forEach((/**
* @param {?} child
* @return {?}
*/
child => {
this.refreshDragNode(child);
}));
}
}
// reset node level
/**
* @param {?} node
* @return {?}
*/
resetNodeLevel(node) {
/** @type {?} */
const parentNode = node.getParentNode();
if (parentNode) {
node.level = parentNode.level + 1;
}
else {
node.level = 0;
}
for (const child of node.children) {
this.resetNodeLevel(child);
}
}
/**
* @param {?} event
* @return {?}
*/
calcDropPosition(event) {
const { clientY } = event;
// to fix firefox undefined
const { top, bottom, height } = event.srcElement
? event.srcElement.getBoundingClientRect()
: ((/** @type {?} */ (event.target))).getBoundingClientRect();
/** @type {?} */
const des = Math.max(height * this.DRAG_SIDE_RANGE, this.DRAG_MIN_GAP);
if (clientY <= top + des) {
return -1;
}
else if (clientY >= bottom - des) {
return 1;
}
return 0;
}
/**
* drop
* 0: inner -1: pre 1: next
* @param {?} targetNode
* @param {?=} dragPos
* @return {?}
*/
dropAndApply(targetNode, dragPos = -1) {
if (!targetNode || dragPos > 1) {
return;
}
/** @type {?} */
const treeService = targetNode.treeService;
/** @type {?} */
const targetParent = targetNode.getParentNode();
/** @type {?} */
const isSelectedRootNode = this.selectedNode.getParentNode();
// remove the dragNode
if (isSelectedRootNode) {
isSelectedRootNode.children = isSelectedRootNode.children.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== this.selectedNode.key));
}
else {
this.rootNodes = this.rootNodes.filter((/**
* @param {?} n
* @return {?}
*/
n => n.key !== this.selectedNode.key));
}
switch (dragPos) {
case 0:
targetNode.addChildren([this.selectedNode]);
this.resetNodeLevel(targetNode);
break;
case -1:
case 1:
/** @type {?} */
const tIndex = dragPos === 1 ? 1 : 0;
if (targetParent) {
targetParent.addChildren([this.selectedNode], targetParent.children.indexOf(targetNode) + tIndex);
/** @type {?} */
const parentNode = this.selectedNode.getParentNode();
if (parentNode) {
this.resetNodeLevel(parentNode);
}
}
else {
/** @type {?} */
const targetIndex = this.rootNodes.indexOf(targetNode) + tIndex;
// 根节点插入
this.rootNodes.splice(targetIndex, 0, this.selectedNode);
this.rootNodes[targetIndex].parentNode = null;
this.rootNodes[targetIndex].level = 0;
}
break;
}
// flush all nodes
this.rootNodes.forEach((/**
* @param {?} child
* @return {?}
*/
child => {
if (!child.treeService) {
child.service = treeService;
}
this.refreshDragNode(child);
}));
}
/**
* emit Structure
* eventName
* node
* event: MouseEvent / DragEvent
* dragNode
* @param {?} eventName
* @param {?} node
* @param {?} event
* @return {?}
*/
formatEvent(eventName, node, event) {
/** @type {?} */
const emitStructure = {
eventName: eventName,
node: node,
event: event
};
switch (eventName) {
case 'dragstart':
case 'dragenter':
case 'dragover':
case 'dragleave':
case 'drop':
case 'dragend':
Object.assign(emitStructure, { dragNode: this.getSelectedNode() });
break;
case 'click':
case 'dblclick':
Object.assign(emitStructure, { selectedKeys: this.selectedNodeList });
Object.assign(emitStructure, { nodes: this.selectedNodeList });
Object.assign(emitStructure, { keys: this.selectedNodeList.map((/**
* @param {?} n
* @return {?}
*/
n => n.key)) });
break;
case 'check':
/** @type {?} */
const checkedNodeList = this.getCheckedNodeList();
Object.assign(emitStructure, { checkedKeys: checkedNodeList });
Object.assign(emitStructure, { nodes: checkedNodeList });
Object.assign(emitStructure, { keys: checkedNodeList.map((/**
* @param {?} n
* @return {?}
*/
n => n.key)) });
break;
case 'search':
Object.assign(emitStructure, { matchedKeys: this.getMatchedNodeList() });
Object.assign(emitStructure, { nodes: this.getMatchedNodeList() });
Object.assign(emitStructure, { keys: this.getMatchedNodeList().map((/**
* @param {?} n
* @return {?}
*/
n => n.key)) });
break;
case 'expand':
Object.assign(emitStructure, { nodes: this.expandedNodeList });
Object.assign(emitStructure, { keys: this.expandedNodeList.map((/**
* @param {?} n
* @return {?}
*/
n => n.key)) });
break;
}
return emitStructure;
}
/**
* @return {?}
*/
ngOnDestroy() {
this.triggerEventChange$.complete();
}
}
NzTreeBaseService.decorators = [
{ type: Injectable }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const NzTreeHigherOrderServiceToken = new InjectionToken('NzTreeHigherOrder');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzWaveRenderer {
/**
* @param {?} triggerElement
* @param {?} ngZone
* @param {?} insertExtraNode
*/
constructor(triggerElement, ngZone, insertExtraNode) {
this.triggerElement = triggerElement;
this.ngZone = ngZone;
this.insertExtraNode = insertExtraNode;
this.waveTransitionDuration = 400;
this.lastTime = 0;
this.onClick = (/**
* @param {?} event
* @return {?}
*/
(event) => {
if (!this.triggerElement ||
!this.triggerElement.getAttribute ||
this.triggerElement.getAttribute('disabled') ||
((/** @type {?} */ (event.target))).tagName === 'INPUT' ||
this.triggerElement.className.indexOf('disabled') >= 0) {
return;
}
this.fadeOutWave();
});
/** @type {?} */
const platform = new Platform();
if (platform.isBrowser) {
this.bindTriggerEvent();
}
}
/**
* @return {?}
*/
get waveAttributeName() {
return this.insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node';
}
/**
* @return {?}
*/
bindTriggerEvent() {
this.ngZone.runOutsideAngular((/**
* @return {?}
*/
() => {
if (this.triggerElement) {
this.triggerElement.addEventListener('click', this.onClick, true);
}
}));
}
/**
* @return {?}
*/
removeTriggerEvent() {
if (this.triggerElement) {
this.triggerElement.removeEventListener('click', this.onClick, true);
}
}
/**
* @return {?}
*/
removeStyleAndExtraNode() {
if (this.styleForPseudo && document.body.contains(this.styleForPseudo)) {
document.body.removeChild(this.styleForPseudo);
this.styleForPseudo = null;
}
if (this.insertExtraNode && this.triggerElement.contains(this.extraNode)) {
this.triggerElement.removeChild((/** @type {?} */ (this.extraNode)));
}
}
/**
* @return {?}
*/
destroy() {
this.removeTriggerEvent();
this.removeStyleAndExtraNode();
}
/**
* @private
* @return {?}
*/
fadeOutWave() {
/** @type {?} */
const node = this.triggerElement;
/** @type {?} */
const waveColor = this.getWaveColor(node);
node.setAttribute(this.waveAttributeName, 'true');
if (Date.now() < this.lastTime + this.waveTransitionDuration) {
return;
}
if (this.isValidColor(waveColor)) {
if (!this.styleForPseudo) {
this.styleForPseudo = document.createElement('style');
}
this.styleForPseudo.innerHTML = `[ant-click-animating-without-extra-node]:after { border-color: ${waveColor}; }`;
document.body.appendChild(this.styleForPseudo);
}
if (this.insertExtraNode) {
if (!this.extraNode) {
this.extraNode = document.createElement('div');
}
this.extraNode.className = 'ant-click-animating-node';
node.appendChild(this.extraNode);
}
this.lastTime = Date.now();
this.runTimeoutOutsideZone((/**
* @return {?}
*/
() => {
node.removeAttribute(this.waveAttributeName);
this.removeStyleAndExtraNode();
}), this.waveTransitionDuration);
}
/**
* @private
* @param {?} color
* @return {?}
*/
isValidColor(color) {
return (!!color &&
color !== '#ffffff' &&
color !== 'rgb(255, 255, 255)' &&
this.isNotGrey(color) &&
!/rgba\(\d*, \d*, \d*, 0\)/.test(color) &&
color !== 'transparent');
}
/**
* @private
* @param {?} color
* @return {?}
*/
isNotGrey(color) {
/** @type {?} */
const match = color.match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);
if (match && match[1] && match[2] && match[3]) {
return !(match[1] === match[2] && match[2] === match[3]);
}
return true;
}
/**
* @private
* @param {?} node
* @return {?}
*/
getWaveColor(node) {
/** @type {?} */
const nodeStyle = getComputedStyle(node);
return (nodeStyle.getPropertyValue('border-top-color') || // Firefox Compatible
nodeStyle.getPropertyValue('border-color') ||
nodeStyle.getPropertyValue('background-color'));
}
/**
* @private
* @param {?} fn
* @param {?} delay
* @return {?}
*/
runTimeoutOutsideZone(fn, delay) {
this.ngZone.runOutsideAngular((/**
* @return {?}
*/
() => setTimeout(fn, delay)));
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const NZ_WAVE_GLOBAL_DEFAULT_CONFIG = {
disabled: false
};
/** @type {?} */
const NZ_WAVE_GLOBAL_CONFIG = new InjectionToken('nz-wave-global-options', {
providedIn: 'root',
factory: NZ_WAVE_GLOBAL_CONFIG_FACTORY
});
/**
* @return {?}
*/
function NZ_WAVE_GLOBAL_CONFIG_FACTORY() {
return NZ_WAVE_GLOBAL_DEFAULT_CONFIG;
}
class NzWaveDirective {
/**
* @param {?} ngZone
* @param {?} elementRef
* @param {?} config
* @param {?} animationType
*/
constructor(ngZone, elementRef, config, animationType) {
this.ngZone = ngZone;
this.elementRef = elementRef;
this.animationType = animationType;
this.nzWaveExtraNode = false;
this.waveDisabled = false;
if (config && typeof config.disabled === 'boolean') {
this.waveDisabled = config.disabled;
}
if (this.animationType === 'NoopAnimations') {
this.waveDisabled = true;
}
}
/**
* @return {?}
*/
ngOnDestroy() {
if (this.waveRenderer) {
this.waveRenderer.destroy();
}
}
/**
* @return {?}
*/
ngOnInit() {
this.renderWaveIfEnabled();
}
/**
* @return {?}
*/
renderWaveIfEnabled() {
if (!this.waveDisabled && this.elementRef.nativeElement) {
this.waveRenderer = new NzWaveRenderer(this.elementRef.nativeElement, this.ngZone, this.nzWaveExtraNode);
}
}
}
NzWaveDirective.decorators = [
{ type: Directive, args: [{
selector: '[nz-wave]',
exportAs: 'nzWave'
},] }
];
/** @nocollapse */
NzWaveDirective.ctorParameters = () => [
{ type: NgZone },
{ type: ElementRef },
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [NZ_WAVE_GLOBAL_CONFIG,] }] },
{ type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
];
NzWaveDirective.propDecorators = {
nzWaveExtraNode: [{ type: Input }]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzWaveModule {
}
NzWaveModule.decorators = [
{ type: NgModule, args: [{
imports: [PlatformModule],
exports: [NzWaveDirective],
declarations: [NzWaveDirective]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzMenuBaseService {
constructor() {
this.menuItemClick$ = new Subject(); // tslint:disable-line no-any
// tslint:disable-line no-any
this.theme$ = new Subject();
this.mode$ = new BehaviorSubject('vertical');
this.inlineIndent$ = new BehaviorSubject(24);
this.check$ = merge(this.theme$, this.mode$, this.inlineIndent$);
this.theme = 'light';
this.mode = 'vertical';
this.inlineIndent = 24;
this.menuOpen$ = new BehaviorSubject(false);
}
// tslint:disable-next-line no-any
/**
* @param {?} menu
* @return {?}
*/
onMenuItemClick(menu) {
this.menuItemClick$.next(menu);
}
/**
* @param {?} mode
* @return {?}
*/
setMode(mode) {
this.mode = mode;
this.mode$.next(mode);
}
/**
* @param {?} theme
* @return {?}
*/
setTheme(theme) {
this.theme = theme;
this.theme$.next(theme);
}
/**
* @param {?} indent
* @return {?}
*/
setInlineIndent(indent) {
this.inlineIndent = indent;
this.inlineIndent$.next(indent);
}
}
NzMenuBaseService.decorators = [
{ type: Injectable }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const NzDropdownHigherOrderServiceToken = new InjectionToken('NzTreeHigherOrder');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const NZ_LOGGER_STATE = new InjectionToken('nz-logger-state');
// Whether print the log
class LoggerService {
/**
* @param {?} _loggerState
*/
constructor(_loggerState) {
this._loggerState = _loggerState;
}
// tslint:disable-next-line:no-any
/**
* @param {...?} args
* @return {?}
*/
log(...args) {
if (this._loggerState) {
console.log(...args);
}
}
// tslint:disable-next-line:no-any
/**
* @param {...?} args
* @return {?}
*/
warn(...args) {
if (this._loggerState) {
console.warn(...args);
}
}
// tslint:disable-next-line:no-any
/**
* @param {...?} args
* @return {?}
*/
error(...args) {
if (this._loggerState) {
console.error(...args);
}
}
// tslint:disable-next-line:no-any
/**
* @param {...?} args
* @return {?}
*/
info(...args) {
if (this._loggerState) {
console.log(...args);
}
}
// tslint:disable-next-line:no-any
/**
* @param {...?} args
* @return {?}
*/
debug(...args) {
if (this._loggerState) {
console.log('[NG-ZORRO-DEBUG]', ...args);
}
}
}
LoggerService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
LoggerService.ctorParameters = () => [
{ type: Boolean, decorators: [{ type: Inject, args: [NZ_LOGGER_STATE,] }] }
];
/**
* @param {?} exist
* @param {?} loggerState
* @return {?}
*/
function LOGGER_SERVICE_PROVIDER_FACTORY(exist, loggerState) {
return exist || new LoggerService(loggerState);
}
/** @type {?} */
const LOGGER_SERVICE_PROVIDER = {
provide: LoggerService,
useFactory: LOGGER_SERVICE_PROVIDER_FACTORY,
deps: [[new Optional(), new SkipSelf(), LoggerService], NZ_LOGGER_STATE]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class LoggerModule {
}
LoggerModule.decorators = [
{ type: NgModule, args: [{
providers: [{ provide: NZ_LOGGER_STATE, useValue: false }, LOGGER_SERVICE_PROVIDER]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { NzAddOnModule, NzClassListAddDirective, NzStringTemplateOutletDirective, AnimationDuration, AnimationCurves, collapseMotion, fadeMotion, helpMotion, moveUpMotion, notificationMotion, slideMotion, slideAlertMotion, zoomMotion, zoomBigMotion, zoomBadgeMotion, NzNoAnimationModule, NzNoAnimationDirective, NzConnectedOverlayDirective, NzOverlayModule, getPlacementName, POSITION_MAP, DEFAULT_TOOLTIP_POSITIONS, DEFAULT_DROPDOWN_POSITIONS, DEFAULT_SUBMENU_POSITIONS, DEFAULT_CASCADER_POSITIONS, DEFAULT_MENTION_POSITIONS, cancelRequestAnimationFrame, reqAnimFrame, SCROLL_SERVICE_PROVIDER_FACTORY, NzScrollService, SCROLL_SERVICE_PROVIDER, NzMeasureScrollbarService, NzUpdateHostClassService, dispatchEvent, dispatchFakeEvent, dispatchKeyboardEvent, dispatchMouseEvent, dispatchTouchEvent, createMouseEvent, createTouchEvent, createKeyboardEvent, createFakeEvent, typeInElement, wrappedErrorMessage, FakeViewportRuler, MockNgZone, NzTreeNode, NzTreeBaseService, NzTreeHigherOrderServiceToken, toArray, arraysEqual, shallowCopyArray, isNotNil, isNil, shallowEqual, isInteger, isEmpty, filterNotEmptyNode, isNonEmptyString, isTemplateRef, isComponent, toBoolean, toNumber, toCssPixel, valueFunctionProp, InputBoolean, InputCssPixel, InputNumber, silentEvent, getElementOffset, findFirstNotEmptyNode, findLastNotEmptyNode, reverseChildNodes, isTouchEvent, getRegExp, getMentions, padStart, padEnd, getRepeatedElement, isPromise, getPercent, getPrecision, ensureNumberInRange, scrollIntoView, getCaretCoordinates, createDebugEle, properties, throttleByAnimationFrameDecorator, timeUnits, NzWaveRenderer, NZ_WAVE_GLOBAL_CONFIG_FACTORY, NZ_WAVE_GLOBAL_DEFAULT_CONFIG, NZ_WAVE_GLOBAL_CONFIG, NzWaveDirective, NzWaveModule, NzMenuBaseService, NzDropdownHigherOrderServiceToken, LoggerModule, LoggerService, NZ_LOGGER_STATE, LOGGER_SERVICE_PROVIDER, LOGGER_SERVICE_PROVIDER_FACTORY };
//# sourceMappingURL=ng-zorro-antd-core.js.map