ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
251 lines • 18.3 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Directive, ElementRef, Input, NgZone, Renderer2 } from '@angular/core';
import { MediaMatcher } from '@angular/cdk/layout';
import { Platform } from '@angular/cdk/platform';
import { fromEvent, Subject } from 'rxjs';
import { auditTime, takeUntil } from 'rxjs/operators';
import { NzUpdateHostClassService } from '../core/services/update-host-class.service';
/** @enum {number} */
var Breakpoint = {
'xxl': 0,
'xl': 1,
'lg': 2,
'md': 3,
'sm': 4,
'xs': 5,
};
export { Breakpoint };
Breakpoint[Breakpoint['xxl']] = 'xxl';
Breakpoint[Breakpoint['xl']] = 'xl';
Breakpoint[Breakpoint['lg']] = 'lg';
Breakpoint[Breakpoint['md']] = 'md';
Breakpoint[Breakpoint['sm']] = 'sm';
Breakpoint[Breakpoint['xs']] = 'xs';
/** @type {?} */
var responsiveMap = {
xs: '(max-width: 575px)',
sm: '(min-width: 576px)',
md: '(min-width: 768px)',
lg: '(min-width: 992px)',
xl: '(min-width: 1200px)',
xxl: '(min-width: 1600px)'
};
var NzRowDirective = /** @class */ (function () {
function NzRowDirective(elementRef, renderer, nzUpdateHostClassService, mediaMatcher, ngZone, platform) {
this.elementRef = elementRef;
this.renderer = renderer;
this.nzUpdateHostClassService = nzUpdateHostClassService;
this.mediaMatcher = mediaMatcher;
this.ngZone = ngZone;
this.platform = platform;
this.nzAlign = 'top';
this.nzJustify = 'start';
this.el = this.elementRef.nativeElement;
this.prefixCls = 'ant-row';
this.actualGutter$ = new Subject();
this.destroy$ = new Subject();
}
/**
* @return {?}
*/
NzRowDirective.prototype.calculateGutter = /**
* @return {?}
*/
function () {
if (typeof this.nzGutter !== 'object') {
return this.nzGutter;
}
else if (this.breakPoint && this.nzGutter[this.breakPoint]) {
return this.nzGutter[this.breakPoint];
}
else {
return 0;
}
};
/**
* @return {?}
*/
NzRowDirective.prototype.updateGutter = /**
* @return {?}
*/
function () {
/** @type {?} */
var actualGutter = this.calculateGutter();
if (this.actualGutter !== actualGutter) {
this.actualGutter = actualGutter;
this.actualGutter$.next(this.actualGutter);
this.renderer.setStyle(this.el, 'margin-left', "-" + this.actualGutter / 2 + "px");
this.renderer.setStyle(this.el, 'margin-right', "-" + this.actualGutter / 2 + "px");
}
};
/**
* @return {?}
*/
NzRowDirective.prototype.watchMedia = /**
* @return {?}
*/
function () {
var _this = this;
// @ts-ignore
Object.keys(responsiveMap).map((/**
* @param {?} screen
* @return {?}
*/
function (screen) {
/** @type {?} */
var matchBelow = _this.mediaMatcher.matchMedia(responsiveMap[screen]).matches;
if (matchBelow) {
_this.breakPoint = screen;
}
}));
this.updateGutter();
};
/** temp solution since no method add classMap to host https://github.com/angular/angular/issues/7289*/
/**
* temp solution since no method add classMap to host https://github.com/angular/angular/issues/7289
* @return {?}
*/
NzRowDirective.prototype.setClassMap = /**
* temp solution since no method add classMap to host https://github.com/angular/angular/issues/7289
* @return {?}
*/
function () {
var _a;
/** @type {?} */
var classMap = (_a = {},
_a["" + this.prefixCls] = !this.nzType,
_a[this.prefixCls + "-" + this.nzType] = this.nzType,
_a[this.prefixCls + "-" + this.nzType + "-" + this.nzAlign] = this.nzType && this.nzAlign,
_a[this.prefixCls + "-" + this.nzType + "-" + this.nzJustify] = this.nzType && this.nzJustify,
_a);
this.nzUpdateHostClassService.updateHostClass(this.el, classMap);
};
/**
* @return {?}
*/
NzRowDirective.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.setClassMap();
this.watchMedia();
};
/**
* @param {?} changes
* @return {?}
*/
NzRowDirective.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.nzType || changes.nzAlign || changes.nzJustify) {
this.setClassMap();
}
if (changes.nzGutter) {
this.updateGutter();
}
};
/**
* @return {?}
*/
NzRowDirective.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var _this = this;
if (this.platform.isBrowser) {
this.ngZone.runOutsideAngular((/**
* @return {?}
*/
function () {
fromEvent(window, 'resize')
.pipe(auditTime(16), takeUntil(_this.destroy$))
.subscribe((/**
* @return {?}
*/
function () { return _this.watchMedia(); }));
}));
}
};
/**
* @return {?}
*/
NzRowDirective.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroy$.next();
this.destroy$.complete();
};
NzRowDirective.decorators = [
{ type: Directive, args: [{
selector: '[nz-row],nz-row',
providers: [NzUpdateHostClassService]
},] }
];
/** @nocollapse */
NzRowDirective.ctorParameters = function () { return [
{ type: ElementRef },
{ type: Renderer2 },
{ type: NzUpdateHostClassService },
{ type: MediaMatcher },
{ type: NgZone },
{ type: Platform }
]; };
NzRowDirective.propDecorators = {
nzType: [{ type: Input }],
nzAlign: [{ type: Input }],
nzJustify: [{ type: Input }],
nzGutter: [{ type: Input }]
};
return NzRowDirective;
}());
export { NzRowDirective };
if (false) {
/** @type {?} */
NzRowDirective.prototype.nzType;
/** @type {?} */
NzRowDirective.prototype.nzAlign;
/** @type {?} */
NzRowDirective.prototype.nzJustify;
/** @type {?} */
NzRowDirective.prototype.nzGutter;
/**
* @type {?}
* @private
*/
NzRowDirective.prototype.el;
/**
* @type {?}
* @private
*/
NzRowDirective.prototype.prefixCls;
/**
* @type {?}
* @private
*/
NzRowDirective.prototype.breakPoint;
/** @type {?} */
NzRowDirective.prototype.actualGutter;
/** @type {?} */
NzRowDirective.prototype.actualGutter$;
/** @type {?} */
NzRowDirective.prototype.destroy$;
/** @type {?} */
NzRowDirective.prototype.elementRef;
/** @type {?} */
NzRowDirective.prototype.renderer;
/** @type {?} */
NzRowDirective.prototype.nzUpdateHostClassService;
/** @type {?} */
NzRowDirective.prototype.mediaMatcher;
/** @type {?} */
NzRowDirective.prototype.ngZone;
/** @type {?} */
NzRowDirective.prototype.platform;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotcm93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