ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
75 lines • 4.53 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { NzUpdateHostClassService } from '../core/services/update-host-class.service';
export class NzFormDirective {
/**
* @param {?} elementRef
* @param {?} renderer
* @param {?} nzUpdateHostClassService
*/
constructor(elementRef, renderer, nzUpdateHostClassService) {
this.elementRef = elementRef;
this.renderer = renderer;
this.nzUpdateHostClassService = nzUpdateHostClassService;
this.nzLayout = 'horizontal';
this.renderer.addClass(elementRef.nativeElement, 'ant-form');
}
/**
* @return {?}
*/
setClassMap() {
this.nzUpdateHostClassService.updateHostClass(this.elementRef.nativeElement, {
[`ant-form-${this.nzLayout}`]: this.nzLayout
});
}
/**
* @return {?}
*/
ngOnInit() {
this.setClassMap();
}
/**
* @return {?}
*/
ngOnChanges() {
this.setClassMap();
}
}
NzFormDirective.decorators = [
{ type: Directive, args: [{
selector: '[nz-form]',
providers: [NzUpdateHostClassService]
},] }
];
/** @nocollapse */
NzFormDirective.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 },
{ type: NzUpdateHostClassService }
];
NzFormDirective.propDecorators = {
nzLayout: [{ type: Input }]
};
if (false) {
/** @type {?} */
NzFormDirective.prototype.nzLayout;
/**
* @type {?}
* @private
*/
NzFormDirective.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzFormDirective.prototype.renderer;
/**
* @type {?}
* @private
*/
NzFormDirective.prototype.nzUpdateHostClassService;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotZm9ybS5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsiZm9ybS9uei1mb3JtLmRpcmVjdGl2ZS50cyJdLCJuY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