ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1,587 lines (1,560 loc) • 228 kB
JavaScript
import { CommonModule, DOCUMENT } from '@angular/common';
import { Directive, ElementRef, Renderer2, Input, TemplateRef, ViewContainerRef, NgModule, isDevMode, Optional, Inject, Injectable, SkipSelf, RendererFactory2, ɵɵdefineInjectable, ɵɵinject, NgZone, EventEmitter, Type, InjectionToken, Pipe } from '@angular/core';
import { __values, __spread, __decorate, __metadata, __read, __assign, __extends } from 'tslib';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { coerceBooleanProperty, _isNumberValue, coerceCssPixelValue, coerceElement } from '@angular/cdk/coercion';
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
import { CdkConnectedOverlay, ConnectionPositionPair } from '@angular/cdk/overlay';
import { startOfWeek, startOfMonth, setYear, isSameYear, isSameMonth, isSameDay, isSameHour, isSameMinute, isSameSecond, differenceInCalendarYears, differenceInCalendarMonths, differenceInCalendarDays, differenceInHours, differenceInMinutes, differenceInSeconds, isToday, isValid } from 'date-fns';
import addMonths from 'date-fns/add_months';
import addYears from 'date-fns/add_years';
import setDay from 'date-fns/set_day';
import setMonth from 'date-fns/set_month';
import { Subject, BehaviorSubject } from 'rxjs';
import { auditTime, take, filter, mapTo } from 'rxjs/operators';
import { Platform, PlatformModule } from '@angular/cdk/platform';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzClassListAddDirective = /** @class */ (function () {
function NzClassListAddDirective(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.classList = [];
}
Object.defineProperty(NzClassListAddDirective.prototype, "nzClassListAdd", {
set: /**
* @param {?} list
* @return {?}
*/
function (list) {
var _this = this;
this.classList.forEach((/**
* @param {?} name
* @return {?}
*/
function (name) {
_this.renderer.removeClass(_this.elementRef.nativeElement, name);
}));
list.forEach((/**
* @param {?} name
* @return {?}
*/
function (name) {
_this.renderer.addClass(_this.elementRef.nativeElement, name);
}));
this.classList = list;
},
enumerable: true,
configurable: true
});
NzClassListAddDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzClassListAdd]',
exportAs: 'nzClassListAdd'
},] }
];
/** @nocollapse */
NzClassListAddDirective.ctorParameters = function () { return [
{ type: ElementRef },
{ type: Renderer2 }
]; };
NzClassListAddDirective.propDecorators = {
nzClassListAdd: [{ type: Input }]
};
return NzClassListAddDirective;
}());
if (false) {
/** @type {?} */
NzClassListAddDirective.prototype.classList;
/**
* @type {?}
* @private
*/
NzClassListAddDirective.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzClassListAddDirective.prototype.renderer;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzStringTemplateOutletDirective = /** @class */ (function () {
function NzStringTemplateOutletDirective(viewContainer, defaultTemplate) {
this.viewContainer = viewContainer;
this.defaultTemplate = defaultTemplate;
// tslint:disable-next-line:no-any
this.inputTemplate = null;
this.inputViewRef = null;
this.defaultViewRef = null;
// tslint:disable-next-line:no-any
this.nzStringTemplateOutletContext = null;
}
Object.defineProperty(NzStringTemplateOutletDirective.prototype, "nzStringTemplateOutlet", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value instanceof TemplateRef) {
this.isTemplate = true;
this.inputTemplate = value;
}
else {
this.isTemplate = false;
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.recreateView = /**
* @return {?}
*/
function () {
if (!this.isTemplate) {
/** use default template when input is string **/
if (!this.defaultViewRef) {
if (this.defaultTemplate) {
this.defaultViewRef = this.viewContainer.createEmbeddedView(this.defaultTemplate, this.nzStringTemplateOutletContext);
}
}
}
else {
/** use input template when input is templateRef **/
if (!this.inputViewRef) {
if (this.inputTemplate) {
this.inputViewRef = this.viewContainer.createEmbeddedView(this.inputTemplate, this.nzStringTemplateOutletContext);
}
}
}
};
// tslint:disable-next-line:no-any
// tslint:disable-next-line:no-any
/**
* @private
* @param {?} value
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.getType =
// tslint:disable-next-line:no-any
/**
* @private
* @param {?} value
* @return {?}
*/
function (value) {
if (value instanceof TemplateRef) {
return 'template';
}
else {
return 'string';
}
};
/**
* @private
* @param {?} changes
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.shouldRecreateView = /**
* @private
* @param {?} changes
* @return {?}
*/
function (changes) {
var nzStringTemplateOutletContext = changes.nzStringTemplateOutletContext, nzStringTemplateOutlet = changes.nzStringTemplateOutlet;
/** @type {?} */
var shouldOutletRecreate = false;
if (nzStringTemplateOutlet) {
if (nzStringTemplateOutlet.firstChange) {
shouldOutletRecreate = true;
}
else {
/** @type {?} */
var previousOutletType = this.getType(nzStringTemplateOutlet.previousValue);
/** @type {?} */
var currentOutletType = this.getType(nzStringTemplateOutlet.currentValue);
shouldOutletRecreate = !(previousOutletType === 'string' && currentOutletType === 'string');
}
}
/** @type {?} */
var shouldContextRecreate = nzStringTemplateOutletContext && this.hasContextShapeChanged(nzStringTemplateOutletContext);
return shouldContextRecreate || shouldOutletRecreate;
};
/**
* @private
* @param {?} ctxChange
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.hasContextShapeChanged = /**
* @private
* @param {?} ctxChange
* @return {?}
*/
function (ctxChange) {
var e_1, _a;
/** @type {?} */
var prevCtxKeys = Object.keys(ctxChange.previousValue || {});
/** @type {?} */
var currCtxKeys = Object.keys(ctxChange.currentValue || {});
if (prevCtxKeys.length === currCtxKeys.length) {
try {
for (var currCtxKeys_1 = __values(currCtxKeys), currCtxKeys_1_1 = currCtxKeys_1.next(); !currCtxKeys_1_1.done; currCtxKeys_1_1 = currCtxKeys_1.next()) {
var propName = currCtxKeys_1_1.value;
if (prevCtxKeys.indexOf(propName) === -1) {
return true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (currCtxKeys_1_1 && !currCtxKeys_1_1.done && (_a = currCtxKeys_1.return)) _a.call(currCtxKeys_1);
}
finally { if (e_1) throw e_1.error; }
}
return false;
}
else {
return true;
}
};
// tslint:disable-next-line:no-any
// tslint:disable-next-line:no-any
/**
* @private
* @param {?} ctx
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.updateExistingContext =
// tslint:disable-next-line:no-any
/**
* @private
* @param {?} ctx
* @return {?}
*/
function (ctx) {
var e_2, _a;
try {
for (var _b = __values(Object.keys(ctx)), _c = _b.next(); !_c.done; _c = _b.next()) {
var propName = _c.value;
// tslint:disable-next-line:no-any
((/** @type {?} */ ((/** @type {?} */ (this.inputViewRef)).context)))[propName] = this.nzStringTemplateOutletContext[propName];
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
/**
* @param {?} changes
* @return {?}
*/
NzStringTemplateOutletDirective.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
/** @type {?} */
var recreateView = this.shouldRecreateView(changes);
if (recreateView) {
if (this.viewContainer) {
this.viewContainer.clear();
this.defaultViewRef = null;
this.inputViewRef = null;
}
this.recreateView();
}
else {
if (this.inputViewRef && this.nzStringTemplateOutletContext) {
this.updateExistingContext(this.nzStringTemplateOutletContext);
}
}
};
NzStringTemplateOutletDirective.decorators = [
{ type: Directive, args: [{
selector: '[nzStringTemplateOutlet]',
exportAs: 'nzStringTemplateOutlet'
},] }
];
/** @nocollapse */
NzStringTemplateOutletDirective.ctorParameters = function () { return [
{ type: ViewContainerRef },
{ type: TemplateRef }
]; };
NzStringTemplateOutletDirective.propDecorators = {
nzStringTemplateOutletContext: [{ type: Input }],
nzStringTemplateOutlet: [{ type: Input }]
};
return NzStringTemplateOutletDirective;
}());
if (false) {
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.isTemplate;
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.inputTemplate;
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.inputViewRef;
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.defaultViewRef;
/** @type {?} */
NzStringTemplateOutletDirective.prototype.nzStringTemplateOutletContext;
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.viewContainer;
/**
* @type {?}
* @private
*/
NzStringTemplateOutletDirective.prototype.defaultTemplate;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzAddOnModule = /** @class */ (function () {
function NzAddOnModule() {
}
NzAddOnModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule],
exports: [NzStringTemplateOutletDirective, NzClassListAddDirective],
declarations: [NzStringTemplateOutletDirective, NzClassListAddDirective]
},] }
];
return NzAddOnModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Alibaba.com 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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
var AnimationDuration = /** @class */ (function () {
function AnimationDuration() {
}
AnimationDuration.SLOW = '0.3s'; // Modal
// Modal
AnimationDuration.BASE = '0.2s';
AnimationDuration.FAST = '0.1s'; // Tooltip
return AnimationDuration;
}());
if (false) {
/** @type {?} */
AnimationDuration.SLOW;
/** @type {?} */
AnimationDuration.BASE;
/** @type {?} */
AnimationDuration.FAST;
}
var AnimationCurves = /** @class */ (function () {
function 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)';
return AnimationCurves;
}());
if (false) {
/** @type {?} */
AnimationCurves.EASE_BASE_OUT;
/** @type {?} */
AnimationCurves.EASE_BASE_IN;
/** @type {?} */
AnimationCurves.EASE_OUT;
/** @type {?} */
AnimationCurves.EASE_IN;
/** @type {?} */
AnimationCurves.EASE_IN_OUT;
/** @type {?} */
AnimationCurves.EASE_OUT_BACK;
/** @type {?} */
AnimationCurves.EASE_IN_BACK;
/** @type {?} */
AnimationCurves.EASE_IN_OUT_BACK;
/** @type {?} */
AnimationCurves.EASE_OUT_CIRC;
/** @type {?} */
AnimationCurves.EASE_IN_CIRC;
/** @type {?} */
AnimationCurves.EASE_IN_OUT_CIRC;
/** @type {?} */
AnimationCurves.EASE_OUT_QUINT;
/** @type {?} */
AnimationCurves.EASE_IN_QUINT;
/** @type {?} */
AnimationCurves.EASE_IN_OUT_QUINT;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var collapseMotion = trigger('collapseMotion', [
state('expanded', style({ height: '*' })),
state('collapsed', style({ height: 0, overflow: 'hidden' })),
state('hidden', style({ height: 0, overflow: 'hidden', borderTopWidth: '0' })),
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))
]);
/** @type {?} */
var treeCollapseMotion = trigger('treeCollapseMotion', [
transition(':leave', [
style({ overflow: 'hidden' }),
animate("150ms " + AnimationCurves.EASE_IN_OUT, style({ height: 0 }))
]),
transition(':enter', [
style({ overflow: 'hidden', height: 0 }),
animate("150ms " + AnimationCurves.EASE_IN_OUT, style({ overflow: 'hidden', height: '*' }))
])
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var ANIMATION_TRANSITION_IN = AnimationDuration.BASE + " " + AnimationCurves.EASE_OUT_QUINT;
/** @type {?} */
var ANIMATION_TRANSITION_OUT = AnimationDuration.BASE + " " + AnimationCurves.EASE_IN_QUINT;
/** @type {?} */
var 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 {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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 {?} */
var 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 {?} */
var 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,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Alibaba.com 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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
/** @type {?} */
var environment = {
isTestMode: false
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var record = {};
/** @type {?} */
var PREFIX = '[NG-ZORRO]:';
/**
* @param {...?} args
* @return {?}
*/
function notRecorded() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
/** @type {?} */
var asRecord = args.reduce((/**
* @param {?} acc
* @param {?} c
* @return {?}
*/
function (acc, c) { return acc + c.toString(); }), '');
if (record[asRecord]) {
return false;
}
else {
record[asRecord] = true;
return true;
}
}
/**
* @param {?} consoleFunc
* @param {...?} args
* @return {?}
*/
function consoleCommonBehavior(consoleFunc) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (environment.isTestMode || (isDevMode() && notRecorded.apply(void 0, __spread(args)))) {
consoleFunc.apply(void 0, __spread(args));
}
}
// Warning should only be printed in dev mode and only once.
/** @type {?} */
var warn = (/**
* @param {...?} args
* @return {?}
*/
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return consoleCommonBehavior.apply(void 0, __spread([(/**
* @param {...?} arg
* @return {?}
*/
function () {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
return console.warn.apply(console, __spread([PREFIX], arg));
})], args));
});
/** @type {?} */
var warnDeprecation = (/**
* @param {...?} args
* @return {?}
*/
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!environment.isTestMode) {
/** @type {?} */
var stack_1 = new Error().stack;
return consoleCommonBehavior.apply(void 0, __spread([(/**
* @param {...?} arg
* @return {?}
*/
function () {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i] = arguments[_i];
}
return console.warn.apply(console, __spread([PREFIX, 'deprecated:'], arg, [stack_1]));
})], args));
}
else {
return (/**
* @return {?}
*/
function () { });
}
});
// Log should only be printed in dev mode.
/** @type {?} */
var log = (/**
* @param {...?} args
* @return {?}
*/
function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (isDevMode()) {
console.log.apply(console, __spread([PREFIX], args));
}
});
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,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) {
if (fallbackValue === void 0) { fallbackValue = 0; }
return _isNumberValue(value) ? Number(value) : fallbackValue;
}
/**
* @param {?} value
* @return {?}
*/
function toCssPixel(value) {
return coerceCssPixelValue(value);
}
// tslint:disable no-any
// tslint:disable no-invalid-this
/**
* Get the function-property type's value
* @template T
* @param {?} prop
* @param {...?} args
* @return {?}
*/
function valueFunctionProp(prop) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return typeof prop === 'function' ? prop.apply(void 0, __spread(args)) : prop;
}
/**
* @template T, D
* @param {?} name
* @param {?} fallback
* @return {?}
*/
function propDecoratorFactory(name, fallback) {
/**
* @param {?} target
* @param {?} propName
* @param {?=} originalDescriptor
* @return {?}
*/
function propDecorator(target, propName, originalDescriptor) {
/** @type {?} */
var privatePropName = "$$__" + propName;
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
warn("The prop \"" + privatePropName + "\" is already exist, it will be overrided by " + name + " decorator.");
}
Object.defineProperty(target, privatePropName, {
configurable: true,
writable: true
});
return {
get: /**
* @return {?}
*/
function () {
return originalDescriptor && originalDescriptor.get
? originalDescriptor.get.bind(this)()
: this[privatePropName];
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (originalDescriptor && originalDescriptor.set) {
originalDescriptor.set.bind(this)(fallback(value));
}
this[privatePropName] = fallback(value);
}
};
}
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 {?}
*/
function InputBoolean() {
return propDecoratorFactory('InputBoolean', toBoolean);
}
/**
* @return {?}
*/
function InputCssPixel() {
return propDecoratorFactory('InputCssPixel', toCssPixel);
}
/**
* @return {?}
*/
function InputNumber() {
// tslint:disable-line: no-any
return propDecoratorFactory('InputNumber', toNumber);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var DISABLED_CLASSNAME = 'nz-animate-disabled';
var NzNoAnimationDirective = /** @class */ (function () {
function NzNoAnimationDirective(element, renderer, animationType) {
this.element = element;
this.renderer = renderer;
this.animationType = animationType;
this.nzNoAnimation = false;
}
/**
* @return {?}
*/
NzNoAnimationDirective.prototype.ngOnChanges = /**
* @return {?}
*/
function () {
this.updateClass();
};
/**
* @return {?}
*/
NzNoAnimationDirective.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
this.updateClass();
};
/**
* @private
* @return {?}
*/
NzNoAnimationDirective.prototype.updateClass = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var 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'
},] }
];
/** @nocollapse */
NzNoAnimationDirective.ctorParameters = function () { return [
{ 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);
return NzNoAnimationDirective;
}());
if (false) {
/** @type {?} */
NzNoAnimationDirective.prototype.nzNoAnimation;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.element;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.renderer;
/**
* @type {?}
* @private
*/
NzNoAnimationDirective.prototype.animationType;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzNoAnimationModule = /** @class */ (function () {
function NzNoAnimationModule() {
}
NzNoAnimationModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzNoAnimationDirective],
exports: [NzNoAnimationDirective],
imports: [CommonModule]
},] }
];
return NzNoAnimationModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzConnectedOverlayDirective = /** @class */ (function () {
function NzConnectedOverlayDirective(cdkConnectedOverlay) {
this.cdkConnectedOverlay = cdkConnectedOverlay;
this.cdkConnectedOverlay.backdropClass = 'nz-overlay-transparent-backdrop';
}
NzConnectedOverlayDirective.decorators = [
{ type: Directive, args: [{
selector: '[cdkConnectedOverlay][nzConnectedOverlay]',
exportAs: 'nzConnectedOverlay'
},] }
];
/** @nocollapse */
NzConnectedOverlayDirective.ctorParameters = function () { return [
{ type: CdkConnectedOverlay }
]; };
return NzConnectedOverlayDirective;
}());
if (false) {
/**
* @type {?}
* @private
*/
NzConnectedOverlayDirective.prototype.cdkConnectedOverlay;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzOverlayModule = /** @class */ (function () {
function NzOverlayModule() {
}
NzOverlayModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzConnectedOverlayDirective],
exports: [NzConnectedOverlayDirective]
},] }
];
return NzOverlayModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var 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 {?} */
var DEFAULT_TOOLTIP_POSITIONS = [POSITION_MAP.top, POSITION_MAP.right, POSITION_MAP.bottom, POSITION_MAP.left];
/** @type {?} */
var DEFAULT_DROPDOWN_POSITIONS = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
POSITION_MAP.topRight,
POSITION_MAP.topLeft
];
/** @type {?} */
var DEFAULT_SUBMENU_POSITIONS = [POSITION_MAP.rightTop, POSITION_MAP.leftTop];
/** @type {?} */
var DEFAULT_MENTION_TOP_POSITIONS = [
new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'bottom' }),
new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'end', overlayY: 'bottom' })
];
/** @type {?} */
var DEFAULT_MENTION_BOTTOM_POSITIONS = [
POSITION_MAP.bottomLeft,
new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'end', overlayY: 'top' })
];
/**
* @param {?} position
* @return {?}
*/
function getPlacementName(position) {
/** @type {?} */
var keyList = ['originX', 'originY', 'overlayX', 'overlayY'];
var _loop_1 = function (placement) {
// @ts-ignore
if (keyList.every((/**
* @param {?} key
* @return {?}
*/
function (key) { return position.connectionPair[key] === POSITION_MAP[placement][key]; }))) {
return { value: placement };
}
};
for (var placement in POSITION_MAP) {
var state_1 = _loop_1(placement);
if (typeof state_1 === "object")
return state_1.value;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} rangeValue
* @return {?}
*/
function sortRangeValue(rangeValue) {
if (Array.isArray(rangeValue)) {
var _a = __read(rangeValue, 2), start = _a[0], end = _a[1];
return start && end && start.isAfterSecond(end) ? [end, start] : [start, end];
}
return rangeValue;
}
/**
* Wrapping kind APIs for date operating and unify
* NOTE: every new API return new CandyDate object without side effects to the former Date object
* NOTE: most APIs are based on local time other than customized locale id (this needs tobe support in future)
* TODO: support format() against to angular's core API
*/
var /**
* Wrapping kind APIs for date operating and unify
* NOTE: every new API return new CandyDate object without side effects to the former Date object
* NOTE: most APIs are based on local time other than customized locale id (this needs tobe support in future)
* TODO: support format() against to angular's core API
*/
CandyDate = /** @class */ (function () {
// locale: string; // Custom specified locale ID
function CandyDate(date) {
if (date) {
if (date instanceof Date) {
this.nativeDate = date;
}
else if (typeof date === 'string' || typeof date === 'number') {
warn('The string type is not recommended for date-picker, use "Date" type');
this.nativeDate = new Date(date);
}
else {
throw new Error('The input date type is not supported ("Date" is now recommended)');
}
}
else {
this.nativeDate = new Date();
}
}
// getLocale(): string {
// return this.locale;
// }
// setLocale(locale: string): CandyDate {
// this.locale = locale;
// return this;
// }
// getLocale(): string {
// return this.locale;
// }
// setLocale(locale: string): CandyDate {
// this.locale = locale;
// return this;
// }
/**
* @param {?=} options
* @return {?}
*/
CandyDate.prototype.calendarStart =
// getLocale(): string {
// return this.locale;
// }
// setLocale(locale: string): CandyDate {
// this.locale = locale;
// return this;
// }
/**
* @param {?=} options
* @return {?}
*/
function (options) {
return new CandyDate(startOfWeek(startOfMonth(this.nativeDate), options));
};
// ---------------------------------------------------------------------
// | Native shortcuts
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// | Native shortcuts
// ---------------------------------------------------------------------
/**
* @return {?}
*/
CandyDate.prototype.getYear =
// ---------------------------------------------------------------------
// | Native shortcuts
// ---------------------------------------------------------------------
/**
* @return {?}
*/
function () {
return this.nativeDate.getFullYear();
};
/**
* @return {?}
*/
CandyDate.prototype.getMonth = /**
* @return {?}
*/
function () {
return this.nativeDate.getMonth();
};
/**
* @return {?}
*/
CandyDate.prototype.getDay = /**
* @return {?}
*/
function () {
return this.nativeDate.getDay();
};
/**
* @return {?}
*/
CandyDate.prototype.getTime = /**
* @return {?}
*/
function () {
return this.nativeDate.getTime();
};
/**
* @return {?}
*/
CandyDate.prototype.getDate = /**
* @return {?}
*/
function () {
return this.nativeDate.getDate();
};
/**
* @return {?}
*/
CandyDate.prototype.getHours = /**
* @return {?}
*/
function () {
return this.nativeDate.getHours();
};
/**
* @return {?}
*/
CandyDate.prototype.getMinutes = /**
* @return {?}
*/
function () {
return this.nativeDate.getMinutes();
};
/**
* @return {?}
*/
CandyDate.prototype.getSeconds = /**
* @return {?}
*/
function () {
return this.nativeDate.getSeconds();
};
/**
* @return {?}
*/
CandyDate.prototype.getMilliseconds = /**
* @return {?}
*/
function () {
return this.nativeDate.getMilliseconds();
};
// ---------------------------------------------------------------------
// | New implementing APIs
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// | New implementing APIs
// ---------------------------------------------------------------------
/**
* @return {?}
*/
CandyDate.prototype.clone =
// ---------------------------------------------------------------------
// | New implementing APIs
// ---------------------------------------------------------------------
/**
* @return {?}
*/
function () {
return new CandyDate(new Date(this.nativeDate));
};
/**
* @param {?} hour
* @param {?} minute
* @param {?} second
* @return {?}
*/
CandyDate.prototype.setHms = /**
* @param {?} hour
* @param {?} minute
* @param {?} second
* @return {?}
*/
function (hour, minute, second) {
/** @type {?} */
var date = new Date(this.nativeDate);
date.setHours(hour, minute, second);
return new CandyDate(date);
};
/**
* @param {?} year
* @return {?}
*/
CandyDate.prototype.setYear = /**
* @param {?} year
* @return {?}
*/
function (year) {
return new CandyDate(setYear(this.nativeDate, year));
};
/**
* @param {?} amount
* @return {?}
*/
CandyDate.prototype.addYears = /**
* @param {?} amount
* @return {?}
*/
function (amount) {
return new CandyDate(addYears(this.nativeDate, amount));
};
// NOTE: month starts from 0
// NOTE: Don't use the native API for month manipulation as it not restrict the date when it overflows, eg. (new Date('2018-7-31')).setMonth(1) will be date of 2018-3-03 instead of 2018-2-28
// NOTE: month starts from 0
// NOTE: Don't use the native API for month manipulation as it not restrict the date when it overflows, eg. (new Date('2018-7-31')).setMonth(1) will be date of 2018-3-03 instead of 2018-2-28
/**
* @param {?} month
* @return {?}
*/
CandyDate.prototype.setMonth =
// NOTE: month starts from 0
// NOTE: Don't use the native API for month manipulation as it not restrict the date when it overflows, eg. (new Date('2018-7-31')).setMonth(1) will be date of 2018-3-03 instead of 2018-2-28
/**
* @param {?} month
* @return {?}
*/
function (month) {
return new CandyDate(setMonth(this.nativeDate, month));
};
/**
* @param {?} amount
* @return {?}
*/
CandyDate.prototype.addMonths = /**
* @param {?} amount
* @return {?}
*/
function (amount) {
return new CandyDate(addMonths(this.nativeDate, amount));
};
/**
* @param {?} day
* @param {?=} options
* @return {?}
*/
CandyDate.prototype.setDay = /**
* @param {?} day
* @param {?=} options
* @return {?}
*/
function (day, options) {
return new CandyDate(setDay(this.nativeDate, day, options));
};
/**
* @param {?} amount
* @return {?}
*/
CandyDate.prototype.setDate = /**
* @param {?} amount
* @return {?}
*/
function (amount) {
/** @type {?} */
var date = new Date(this.nativeDate);
date.setDate(amount);
return new CandyDate(date);
};
/**
* @param {?} amount
* @return {?}
*/
CandyDate.prototype.addDays = /**
* @param {?} amount
* @return {?}
*/
function (amount) {
return this.setDate(this.getDate() + amount);
};
/**
* @param {?} date
* @param {?=} grain
* @return {?}
*/
CandyDate.prototype.isSame = /**
* @param {?} date
* @param {?=} grain
* @return {?}
*/
function (date, grain) {
if (grain === void 0) { grain = 'day'; }
/** @type {?} */
var fn;
switch (grain) {
case 'year':
fn = isSameYear;
break;
case 'month':
fn = isSameMonth;
break;
case 'day':
fn = isSameDay;
break;
case 'hour':
fn = isSameHour;
break;
case 'minute':
fn = isSameMinute;
break;
case 'second':
fn = isSameSecond;
break;
default:
fn = isSameDay;
break;
}
return fn(this.nativeDate, this.toNativeDate(date));
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameYear = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'year');
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameMonth = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'month');
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameDay = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'day');
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameHour = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'hour');
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameMinute = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'minute');
};
/**
* @param {?} date
* @return {?}
*/
CandyDate.prototype.isSameSecond = /**
* @param {?} date
* @return {?}
*/
function (date) {
return this.isSame(date, 'second');
};
/**
* @param {?} date
* @param {?=} grain
* @param {?=} isBefore
* @return {?}
*/