UNPKG

ng-zorro-antd-yj

Version:

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

108 lines 7.39 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; var NzStringTemplateOutletDirective = /** @class */ (function () { function NzStringTemplateOutletDirective(viewContainer, defaultTemplate) { this.viewContainer = viewContainer; this.defaultTemplate = defaultTemplate; this.inputTemplate = null; this.inputViewRef = null; this.defaultViewRef = 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; } this.updateView(); }, enumerable: true, configurable: true }); /** * @return {?} */ NzStringTemplateOutletDirective.prototype.updateView = /** * @return {?} */ function () { 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]' },] } ]; /** @nocollapse */ NzStringTemplateOutletDirective.ctorParameters = function () { return [ { type: ViewContainerRef }, { type: TemplateRef } ]; }; NzStringTemplateOutletDirective.propDecorators = { nzStringTemplateOutlet: [{ type: Input }] }; return NzStringTemplateOutletDirective; }()); export { NzStringTemplateOutletDirective }; if (false) { /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.isTemplate; /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.inputTemplate; /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.inputViewRef; /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.defaultViewRef; /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.viewContainer; /** * @type {?} * @private */ NzStringTemplateOutletDirective.prototype.defaultTemplate; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nX3RlbXBsYXRlX291dGxldC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQteWovIiwic291cmNlcyI6WyJjb3JlL2FkZG9uL3N0cmluZ190ZW1wbGF0ZV9vdXRsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQW1CLEtBQUssRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFakc7SUFTRSx5Q0FBb0IsYUFBK0IsRUFBVSxlQUFrQztRQUEzRSxrQkFBYSxHQUFiLGFBQWEsQ0FBa0I7UUFBVSxvQkFBZSxHQUFmLGVBQWUsQ0FBbUI7UUFKdkYsa0JBQWEsR0FBNkIsSUFBSSxDQUFDO1FBQy9DLGlCQUFZLEdBQWlDLElBQUksQ0FBQztRQUNsRCxtQkFBYyxHQUFpQyxJQUFJLENBQUM7SUFFc0MsQ0FBQztJQUVuRyxzQkFDSSxtRUFBc0I7Ozs7O1FBRDFCLFVBQzJCLEtBQWlDO1lBQzFELElBQUksS0FBSyxZQUFZLFdBQVcsRUFBRTtnQkFDaEMsSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLENBQUM7Z0JBQ3ZCLElBQUksQ0FBQyxhQUFhLEdBQUcsS0FBSyxDQUFDO2FBQzVCO2lCQUFNO2dCQUNMLElBQUksQ0FBQyxVQUFVLEdBQUcsS0FBSyxDQUFDO2FBQ3pCO1lBQ0QsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDO1FBQ3BCLENBQUM7OztPQUFBOzs7O0lBRUQsb0RBQ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